在 Mac OSX 上使用虚拟环境安装 Django CMS 时遇到 MySQL 错误

10

使用虚拟环境安装 Django CMS 和 MySQL 时,我尝试出现以下错误:

RuntimeError: maximum recursion depth exceeded

/Users/ethan/Sites/env/build/mysql-python/distribute-0.6.28-py2.7.egg

Traceback (most recent call last):

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

  File "/Users/ethan/Sites/env/build/mysql-python/setup.py", line 7, in <module>

    use_setuptools()

  File "distribute_setup.py", line 145, in use_setuptools

    return _do_download(version, download_base, to_dir, download_delay)

  File "distribute_setup.py", line 125, in _do_download

    _build_egg(egg, tarball, to_dir)

  File "distribute_setup.py", line 116, in _build_egg

    raise IOError('Could not build the egg.')

IOError: Could not build the egg.

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /Users/ethan/Sites/env/build/mysql-python

我正在使用以下命令进行安装:

env/bin/pip install --download-cache=~/.pip-cache -r reqs.txt

而reqs.txt文件看起来像这样:

django-cms==2.4.1  
Django==1.5.1  
django-classy-tags==0.4  
South==0.8.1  
html5lib==1.0b1  
django-mptt==0.5.2  
django-sekizai==0.7  
six==1.3.0  
Pillow==2.0.0  
django-filer==0.9.4  
cmsplugin-filer==0.9.5  
django-reversion==1.7  
mysql-python==1.2.4  

我是django的新手(只是在学习教程),在搜索中找不到任何解决这个问题的内容。有人有什么想法吗?


当您尝试运行“pip install -r reqs.txt”时,您的virtualenv是否处于活动状态? - Aaron Lelevier
你的意思是激活虚拟环境,是否已经运行了 source env/bin/activate 命令?如果是,是的。 - fraxture
我在virtualenv激活状态下尝试了它,即在运行上述命令后,再次在运行source ~/.bash_profile后尝试。出现了相同的错误。这可能与它找不到我的mysql安装有关吗? - fraxture
1
大多数 Django 开发人员使用 Postgres SQL。我建议使用 Postgres,因为我从未遇到过这个问题。关于 MySQL 是否与 VirtualEnv 冲突,我不确定。 - Aaron Lelevier
@AronYsidoro,好的,我采纳了你的建议,确实有效。猜想mysql链接可能存在问题? - fraxture
很好。我一直很喜欢Postgres。目前为止一切顺利!很高兴它对你有用! - Aaron Lelevier
3个回答

15

将您的需求更改为mysql-python==1.2.5,我在CentOS 6.3服务器上遇到了同样的问题。


9

mysql-python v.1.2.4 在分发版本0.6.28上有一个硬依赖。它可能没有选择正确的分发版本。

在虚拟环境激活后运行以下命令:

easy_install distribute==0.6.28

并且您应该已经准备好进行,继续下一步操作。
env/bin/pip install --download-cache=~/.pip-cache -r reqs.txt

2
将要求更改为mysql-python == 1.2.5,在OS X Mavericks上使用pip安装也适用于我。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接