我刚刚学会了如何使用virtualenv,并且我安装了Django 1.4.5。我假设virtualenv为我的工作创造了一张白纸,所以在安装了Django1.4.5之后,我把以前的所有文件都复制到了virtualenv环境中。
我试图运行服务器,但我得到了一个错误,说"no module named MySQLdb"。我想这意味着我忘记安装MySQL-python了。我试着通过
pip install MySQL-python但是我得到了这个错误
Downloading/unpacking MySQL-python
Running setup.py egg_info for package MySQL-python
The required version of distribute (>=0.6.28) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U distribute'.
(Currently using distribute 0.6.24 (/home/bradford/Development/Django/django_1.4.5/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg))
Complete output from command python setup.py egg_info:
The required version of distribute (>=0.6.28) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U distribute'.
(Currently using distribute 0.6.24 (/home/bradford/Development/Django/django_1.4.5/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg))
----------------------------------------
Command python setup.py egg_info failed with error code 2 in /home/bradford/Development/Django/django_1.4.5/build/MySQL-python不太确定如何解决这个问题=/任何帮助非常感谢!
发布于 2013-05-08 18:40:00
我最近就遇到了这个问题(只是与Django无关)。在我的例子中,我是在Ubuntu12.04上使用默认的pip和分发版本进行开发的,这对于MySQL-python来说基本上是有点过时了。
因为您是在独立的virtualenv中工作,所以可以安全地按照建议的说明操作,而不会影响Python安装。
所以你可以..。
workon your_virtualenv #activate your virtualenv, you do use virtualenvwrapper, right?
easy_install -U distribute #update distribute on your virtualenv
pip install MySQL-python #install your package如果由于某种原因不能升级分发,您可以尝试安装一个旧版本的MySQL-python,如下所示(您必须检查此版本是否与您的Django版本兼容):
pip install MySQL-python==x.y.z #where x.y.z is the version you want发布于 2013-10-05 02:07:59
花了一个小时查看堆栈溢出。实际找到的答案是in the other question。这就是我的救星:
sudo apt-get install libmysqlclient-devmysql_config随包一起提供。
发布于 2014-09-21 19:12:46
在虚拟环境中执行以下操作时:
pip install MySQL-python我得到了
EnvironmentError: mysql_config not found要安装mysql_config,正如Artem Fedosov所说,首先要安装
sudo apt-get install libmysqlclient-dev那么在虚拟环境中一切都能正常工作
https://stackoverflow.com/questions/16438259
复制相似问题