【问题标题】:Keep returning error when trying to install MySQL-python on mac尝试在 Mac 上安装 MySQL-python 时不断返回错误
【发布时间】:2020-12-26 09:01:39
【问题描述】:

我试过sudo pip install MySQL-python 我的 Mac 10.14 上有 python 3 和 python 2

我不断收到此错误:

ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-00klz8kk/mysql-python/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-00klz8kk/mysql-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/tmp/pip-pip-egg-info-98ox2mo0
         cwd: /private/tmp/pip-install-00klz8kk/mysql-python/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-install-00klz8kk/mysql-python/setup.py", line 13, in <module>
        from setup_posix import get_config
      File "/private/tmp/pip-install-00klz8kk/mysql-python/setup_posix.py", line 2, in <module>
        from ConfigParser import SafeConfigParser
    ModuleNotFoundError: No module named 'ConfigParser'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

【问题讨论】:

  • 根据docs.python.org/2/library/configparser.html,并且您使用的是python3.8,似乎pip install mysql-python 使用了python3 pip。这意味着,您需要使用 python2 的 pip(我猜是 pip2?)
  • 进一步的建议..你也可以试试pymysql

标签: python mysql macos


【解决方案1】:

尝试安装以下相同的,

pip install pymysql
pip install mysql-connector
pip intsall mysql-connector-python

【讨论】:

    猜你喜欢
    • 2018-03-19
    • 2015-10-30
    • 1970-01-01
    • 2021-08-02
    • 2013-05-10
    • 2020-01-19
    • 2020-03-01
    • 1970-01-01
    • 2021-08-30
    相关资源
    最近更新 更多