MySQL 导入错误:没有名为 connector.conversion 的模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24267017/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ImportError: No module named connector.conversion
提问by user3749020
I'm very new to mySQL and just installed it on my Mac (OS 10.6.8). When I try to connect with the database through Terminal, I get this message:
我对 mySQL 非常陌生,刚刚将它安装在我的 Mac(OS 10.6.8)上。当我尝试通过终端连接数据库时,我收到以下消息:
Last login: Tue Jun 17 10:42:23 on console mysqluc -e "help utilities" GEdit-2:~ Eric$ mysqluc -e "help utilities" Traceback (most recent call last): File "/bin/mysqluc", line 23, in from mysql.utilities.common.options import license_callback, UtilitiesParser File "/Library/Python/2.6/site-packages/mysql/utilities/common/options.py", line 35, in from mysql.connector.conversion import MySQLConverter ImportError: No module named connector.conversion
上次登录: 6 月 17 日星期二 10:42:23 在控制台上 mysqluc -e "help Utility" GEdit-2:~ Eric$ mysqluc -e "help Utility" Traceback(最近一次调用最后一次):文件“/bin/mysqluc”,第 23 行,来自 mysql.utilities.common.options 导入 license_callback,UtilitiesParser 文件“/Library/Python/2.6/site-packages/mysql/utilities/common/options.py”,第 35 行,来自 mysql.connector.conversion导入 MySQLConverter 导入错误:没有名为 connector.conversion 的模块
After reading in this and other forums, I installed:
在本论坛和其他论坛阅读后,我安装了:
mySQL-connector-python 1.2.2
I also added this path:
我还添加了这条路径:
PATH=/usr/local/git/bin:/usr/local/mysql/bin:$PATH
But, nothing has helped.
但是,没有任何帮助。
I have also tried to install:
我也尝试安装:
mySQL-connector-odbc 5.3.2
mySQL-connector-odbc 5.3.2
but, the installation fails.
但是,安装失败。
Any help would be greatly appreciated.
任何帮助将不胜感激。
Eric
埃里克
回答by user1855221
From Can't run MySql Utilities:
MYSQL Utilities assumes that the MySQL Connector for Python has been installed. If you install it (http://dev.mysql.com/downloads/connector/python/), MySQL Utilities should run OK.
MYSQL Utilities 假定已安装 MySQL Connector for Python。如果您安装它(http://dev.mysql.com/downloads/connector/python/),MySQL Utilities 应该可以正常运行。
回答by Jan Clemens Stoffregen
I tried solving this for hours and ended up using the mysqldb library instead of mysql-connector for python. (Using Mac osSierra 10.12) It was enough for my purposes though I can't ensure that it would be enough for everybodies purposes.
我尝试解决这个问题几个小时,最终使用 mysqldb 库而不是 mysql-connector for python。(使用 Mac osSierra 10.12)这对我来说已经足够了,尽管我不能确保它对所有人来说都足够了。
回答by Frederic
I had the same problem. Searching on Internet I met the solution. We have to install the library given by Python:
我有同样的问题。在互联网上搜索我遇到了解决方案。我们必须安装 Python 提供的库:
sudo apt-get install python3-mysql.connector
Or, if Python 2:
或者,如果 Python 2:
sudo apt-get install python-mysql.connector
Thanks to: https://askubuntu.com/questions/1014947/mysql-connector-python-importerror-no-module-named-mysql
感谢:https: //askubuntu.com/questions/1014947/mysql-connector-python-importerror-no-module-named-mysql
回答by geochanto
MySQL connector is required...but it seems this version is bugging out and not installing on Mac OSmysql-connector-python-8.0.15-macos10.14.dmg
.
MySQL 连接器是必需的...但似乎此版本已出问题并且未在 Mac OS 上安装mysql-connector-python-8.0.15-macos10.14.dmg
。
If someone is having the same problem, you can install pymysqlinstead, as this postsuggests.