无法安装mysql python连接器macOS High Sierra

时间:2018-03-23 22:25:56

标签: python mysql macos-sierra connector

当我尝试使用pip3安装mysql-python适配器时,我收到以下错误消息:

$ pip3 install mysql-python
Collecting mysql-python
  Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/vx/gzl69zd16lg9s4_xsgpnldv00000gn/T/pip-build-qkxwtgtw/mysql-python/setup.py", line 13, in <module>
    from setup_posix import get_config
  File "/private/var/folders/vx/gzl69zd16lg9s4_xsgpnldv00000gn/T/pip-build-qkxwtgtw/mysql-python/setup_posix.py", line 2, in <module>
    from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in 
/private/var/folders/vx/gzl69zd16lg9s4_xsgpnldv00000gn/T/pip-build- 
qkxwtgtw/mysql-python/

2 个答案:

答案 0 :(得分:0)

它在错误消息中说明了:

ModuleNotFoundError: No module named 'ConfigParser'

Python 3 ImportError: No module named 'ConfigParser'

答案 1 :(得分:0)

  1. ModuleNotFoundError: No module named 'ConfigParser'告诉我们,您需要先安装ConfigParser。

  2. MySQL-python-1.2.5似乎很老了。不确定它是否支持Python 3.也许试试https://pypi.python.org/pypi/mysqlclient

  3. 如果您使用的是Windows,有时可以从.whl下载和安装