我遇到了macOSX和virtualenv的问题。它似乎忽略了--no-site-package。 使用与linux(archlinux)完全相同的命令,它可以工作。它是macOSX 10.5 with python 2.5
curl -o virtualenv.py 'http://bitbucket.org/ianb/virtualenv/raw/tip/virtualenv.py
创建新环境
python virtualenv.py --no-site-packages foo
New python executable in foo/bin/python
Installing setuptools...........................done.
激活它
source foo/bin/activate
尝试在其中安装内容。尽管virtualenv它寻找系统范围的安装
easy_install cherrypy
Searching for cherrypy
Best match: CherryPy 3.1.2
Adding CherryPy 3.1.2 to easy-install.pth file
Using /Library/Python/2.5/site-packages
Processing dependencies for cherrypy
Finished processing dependencies for cherrypy
但它找不到模块
(foo)guidage-multimodal:~ tristram$ python
Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cherrypy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cherrypy
在查看virtualenv --no-site-packages and pip still finding global packages?后我尝试了PIP 但是它无法安装psycopg2(gcc的一些问题)。此外,我希望能够有一个完整的woork的setup.py(来自分发)
更新在macOS 10.6上,它可以正常工作。也许是python 2.5到旧,或者安装坏了,所以我放弃了,将需要macOS 10.6 ......
答案 0 :(得分:1)
也可能是easy_install版本太旧了。 我建议使用pip:
easy_install pip
pip install virtualenv -U
virtualenv env
source env/bin/activate
pip -E env install cherrypy