我现在的django项目需要'virtualenv'。我可以安装它,以及请求的目录 是用一些基本的子目录(bin,include,lib)创建的,但是它会停止在让我猜测的错误消息上。所以我希望有人知道这个问题,并且可以提供帮助吗?
下面是一些非常有用的控制台文本输出。
提前多多感谢! 海伦
计算机配置:MacOS 10.6.8(Snow Leopard),Python 2.7。
1)创建virtualenv:
Suesssauer:site-packages sss$ virtualenv --distribute /Users/sss/EclipseProjects/django-projects/DEV
New python executable in /Users/sss/EclipseProjects/django-projects/DEV/bin/python
Please make sure you remove any previous custom paths from your /Users/sss/.pydistutils.cfg file.
COMMENT: fyi – Contents of .pydistutils.cfg
>> [install]
>> install_lib = /Library/Python/$py_version_short/site-packages )
Installing distribute........................................done.
Installing pip....
Complete output from command /Users/sss/Ecli...DEV/bin/python -x
/Users/sss/Ecli...VEL/bin/easy_install /Library/Python/2.7/...pport/pip-1.1.tar.gz:
/Users/sss/EclipseProjects/django-projects/DEV/bin/python:
can't open file '/Users/sss/EclipseProjects/django-projects/DEV/bin/easy_install':
[Errno 2] No such file or directory
评论:这是真的,它缺失了。但手动复制它不是我的工作,不是吗?
...Installing pip...done.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenv", line 8,
in <module> load_entry_point('virtualenv==1.7.2', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv.py", line 942, in main
never_download=options.never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 1054, in create_environment
install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 654, in install_pip
filter_stdout=_filter_setup)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 1020, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/sss/Ecli...ork_DEVEL/bin/python -x /Users/sss/Ecli...VEL/
bin/easy_install /Library/Python/2.7/...pport/pip-1.1.tar.gz failed with
error code 2
不知道,文件“/Library/Python/2.7/site-packages/virtualenv_support/pip-1.1.tar.gz”确实存在(如果这是谈到的那个)!
2)问题:检查virtualenv的安装 - 我是否必须考虑下面的这些警告?
控制台输出:
Suesssauer:site-packages sss$ pip install virtualenv
Downloading/unpacking virtualenv
Downloading virtualenv-1.7.2.tar.gz (2.2Mb): 2.2Mb downloaded
Running setup.py egg_info for package virtualenv
warning: no previously-included files matching '*' found under directory 'docs/_templates'
warning: no previously-included files matching '*' found under directory 'docs/_build'
Installing collected packages: virtualenv
Running setup.py install for virtualenv
warning: no previously-included files matching '*' found under directory 'docs/_templates'
warning: no previously-included files matching '*' found under directory 'docs/_build'
Installing virtualenv script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Installing virtualenv-2.7 script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Successfully installed virtualenv
Cleaning up...
答案 0 :(得分:0)
这不是你问题的直接解决方案,但我强烈建议你使用virtualenv-burrito,这是与virtualenv-wrapper类打包的通常的virtualenv,这使得组织你的virtualenvs更容易。
Virtualenv-burrtio:https://github.com/brainsik/virtualenv-burrito
答案 1 :(得分:0)
在运行.pydistutils.cfg
之前,请按照要求尝试“删除”virtualenv
文件:
mv /Users/sss/.pydistutils.cfg /Users/sss/.pydistutils.cfg.old
来源:https://groups.google.com/forum/#!msg/python-virtualenv/dKZYWuMcI7Y/Z27XXKF5M4sJ
我认为错误代码2也归因于easy_install
,而不是.tar.gz
文件。