gpt4 book ai didi

python - 在 osx for django 的 virtualenv 中安装 mysql

转载 作者:可可西里 更新时间:2023-11-01 08:29:24 26 4
gpt4 key购买 nike

我一直在尝试为我的 django 项目安装 mysql。我正在运行 osx yosemite 10.10 和 django=1.7、python 2.7,以及虚拟环境。当我尝试运行 pip install MySQL-python 时出现以下错误:

You are using pip version 6.0.8, however version 7.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
DEPRECATION: --no-install and --no-download are deprecated. See https://github.com/pypa/pip/issues/906.
Collecting MySQL-python
Using cached MySQL-python-1.2.5.zip
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/Volumes/DiskSecond/pythonsNest/env2/build/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
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found

Traceback (most recent call last):

File "<string>", line 20, in <module>

File "/Volumes/DiskSecond/pythonsNest/env2/build/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

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /Volumes/DiskSecond/pythonsNest/env2/build/MySQL-python

我已经在我的系统上全局安装了 python,但是 django 安装在名为==env2 的虚拟环境中。当我检查我的 env2 的构建文件夹时,已经有一个名为 s 的文件夹,其中包含所有 mysql 文件。但是在使用 pip 安装它时仍然出现错误。问题出在哪里??

最佳答案

您需要在控制台中执行此操作:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

然后

brew install mysql
pip install mysql-python

关于python - 在 osx for django 的 virtualenv 中安装 mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30954647/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com