我无法安装任何修复程序。我尝试了以下命令。
pip install MySQL-python when I run this please see the screen shot in error
pip安装mysqlclient brew安装mysql brew安装 libmysqlclient-dev
more pictures [![enter image description here][1]][1][![enter image description here][1]][1]
PASML-1717136:server $ Python2.7 main.py
Traceback (most recent call last):
File "main.py", line 68, in <module>
HANDLER = get_handlers()
File "main.py", line 59, in get_handlers
adapter = MysqlAdapter(CONFIG.DB_CONN)
File "/Users/mnaeem668/Projects/Automation_KPI/server/../server/adapters/mysql_adapter.py", line 24, in __init__
self._connect()
File "/Users/mnaeem668/Projects/Automation_KPI/server/../server/adapters/mysql_adapter.py", line 33, in _connect
self.engine = create_engine(conn_str)
File "/Library/Python/2.7/site-packages/sqlalchemy/engine/__init__.py", line 479, in create_engine
return strategy.create(*args, **kwargs)
File "/Library/Python/2.7/site-packages/sqlalchemy/engine/strategies.py", line 87, in create
dbapi = dialect_cls.dbapi(**dbapi_args)
File "/Library/Python/2.7/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 118, in dbapi
return __import__("MySQLdb")
ImportError: No module named MySQLdb
Exception AttributeError: "'NoneType' object has no attribute 'close'" in <bound method MysqlAdapter.__del__ of <server.adapters.mysql_adapter.MysqlAdapter object at 0x11240cb50>> ignored
更新:安装python-MySQLdb
ERROR: Could not find a version that satisfies the requirement python-MySQLdb (from versions: none)
ERROR: No matching distribution found for python-MySQLdb
答案 0 :(得分:1)
似乎您尝试安装python-mysql而不在您的计算机上安装mysql及其依赖项。 从屏幕快照中可以看出您正在MacOS上运行。 请查看以下评论:
mySQLdb是mysql的python接口,但不是mysql本身。显然,mySQLdb需要命令“ mysql_config”,因此您需要先安装该命令。
您可以通过从shell运行“ mysql”来确认自己是否安装了mysql吗?除了“ mysql:not found”外,这应该给您一个响应。
并查看有关在MacOS上安装的以下注释 mysql_config not found when installing mysqldb python interface