相关疑难解决方法(0)

安装mysqldb python接口时找不到mysql_config

我试图让一个Python脚本在我通过ssh连接的linux服务器上运行.该脚本使用mysqldb.我有我需要的所有其他组件,但是当我尝试通过setuptools安装mySQLdb时,如:

python setup.py install
Run Code Online (Sandbox Code Playgroud)

我得到以下与该mysql_config命令相关的错误报告.

sh: mysql_config: command not found
Traceback (most recent call last):
  File "setup.py", line 15, in <module>
    metadata, options = get_config()
  File "/usr/lib/python2.5/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "/usr/lib/python2.5/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
Run Code Online (Sandbox Code Playgroud)

是否有其他人遇到此错误,如果是这样,您是如何解决它/我该怎么做才能成功安装mysqldb?

python linux ssh mysql-python

428
推荐指数
21
解决办法
40万
查看次数

安装 MySQL-python 失败

我想在 python 2.7 虚拟环境中安装 MySQL-python,但出现以下错误:

Installing collected packages: MySQL-python
Running setup.py install for MySQL-python ... error
ERROR: Command errored out with exit status 1:
 command: /home/jhylands/py2/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-scNGlE/MySQL-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-scNGlE/MySQL-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-FUMQGL/install-record.txt --single-version-externally-managed --compile --install-headers /home/jhylands/py2/include/site/python2.7/MySQL-python
     cwd: /tmp/pip-install-scNGlE/MySQL-python/
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py …
Run Code Online (Sandbox Code Playgroud)

python mysql mysql-python python-2.7

4
推荐指数
2
解决办法
1565
查看次数

标签 统计

mysql-python ×2

python ×2

linux ×1

mysql ×1

python-2.7 ×1

ssh ×1