在终端(Mac)中尝试通过“ pip install mysqldb”安装MySQLdb时出错

时间:2019-11-14 07:44:44

标签: python pip package mysql-python

我正在使用pyCharm和Qt Designer构建一个桌面应用程序。我想使用MySQL作为数据库。我尝试在pyCharm中导入MySQLdb,但是注意到我没有安装它。我尝试通过运行安装它:

pip3 install MySQLdb

我收到以下错误:

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-_yurhed8/mysql-python/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-_yurhed8/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-install-_yurhed8/mysql-python/pip-egg-info
         cwd: /private/tmp/pip-install-_yurhed8/mysql-python/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-install-_yurhed8/mysql-python/setup.py", line 13, in <module>
        from setup_posix import get_config
      File "/private/tmp/pip-install-_yurhed8/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.

该如何解决? (我在Mac中)

*注意:我已经安装并运行了MySql,并且已经安装并运行了MySqlWorkbench

**已修复-按照此链接上的说明进行操作:https://ruddra.com/posts/install-mysqlclient-macos/

0 个答案:

没有答案