python - 无法在 Virtualenv 中 pip 安装 MySQL-python

标签 python mysql pip virtualenv

尝试在虚拟环境中 pip install MySQL-python,在虚拟环境之外尝试 pip install 时也出现错误。

我已经阅读了类似的问题并尝试了所有建议的解决方案,但是 1) 没有一个有效,并且 2) 我仍然不太明白造成这种情况的原因。有人可以帮帮我吗?

提前为这个菜鸟问题道歉,我对此很陌生。

这是错误:

(env)ryans-air:outreach ryanfarley$ pip install MySQL-python Collecting MySQL-python /Users/ryanfarley/Desktop/outreach/env/lib/python2.7/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Using cached MySQL-python-1.2.5.zip Complete output from command python setup.py egg_info: sh: mysql_config: command not found Traceback (most recent call last): File "", line 20, in File "/private/var/folders/fb/5pp5q35x541493ccjj7g0w580000gn/T/pip-build-BIQjaP/MySQL-python/setup.py", line 17, in 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

---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in

/private/var/folders/fb/5pp5q35x541493ccjj7g0w580000gn/T/pip-build-BIQjaP/MySQL-python

最佳答案

MySQL库没有安装或者安装包时pip找不到。 MySQL-python 包将依赖于您系统上的 MySQL 库和可执行文件(在 mysql_config 的情况下)。

参见 pip install mysql-python fails with EnvironmentError: mysql_config not found .

关于python - 无法在 Virtualenv 中 pip 安装 MySQL-python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33325883/

相关文章:

Zip 文件的 Python 问题

php - PHP/MySQL 中的间歇性 "No Database Selected"?

python - clang 错误: unknown argument: '-mno-fused-madd' (python package installation failure)

python - Python中函数的静态成员?

python - Python 脚本的文件名和行号

python - 如何并行运行多个阻塞 IO 协程

mysql - 如何按文本的第一个字母分组

php - 简单的 PHP 'blog entry' 表单没有提交到 MYSQL 数据库?

python - pip2 和 pip3 的不同自定义安装位置

pip - 通过 setup.py 安装但不通过 pip 安装时出现未知额外错误