pip install MySQL-python==1.2.5 不工作[重复]

Posted

技术标签:

【中文标题】pip install MySQL-python==1.2.5 不工作[重复]【英文标题】:pip install MySQL-python==1.2.5 not working [duplicate] 【发布时间】:2021-05-14 08:12:48 【问题描述】:

我正在尝试使用 pip 安装 mysql-python。 我正在使用 Python v2.7.18 和 pip v20.3.4

我正在尝试:

pip install MySQL-python==1.2.5

但它给出了这个错误:

Defaulting to user installation because normal site-packages is not writeable
Collecting MySQL-python==1.2.5
  Using cached MySQL-python-1.2.5.zip (108 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zuV7aL/mysql-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zuV7aL/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 /tmp/pip-pip-egg-info-TefBrj
         cwd: /tmp/pip-install-zuV7aL/mysql-python/
    Complete output (10 lines):
    sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-zuV7aL/mysql-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我做错了什么?

【问题讨论】:

***.com/… 【参考方案1】:

您需要为 mysql 客户端安装开发库:

sudo apt-get install libmysqlclient-dev

【讨论】:

以上是关于pip install MySQL-python==1.2.5 不工作[重复]的主要内容,如果未能解决你的问题,请参考以下文章

python pip install mysql-python报错

pip install mysql-Python

windows10 pip install MySQL-python mysqlclient

pip install MySQL-python 出错 [重复]

pip install MySQL-python==1.2.5 不工作[重复]

python2.x下pip install mysql-python报错解决办法