4

我正在尝试创建一个 Flask 应用程序来推送到 Heroku。当我尝试在文件夹中创建 virtualenv 时,我抛出了这个错误:

photo-crawl › sudo virtualenv venv --distribute
Password:
New python executable in venv/bin/python
Installing distribute............................................................................................................................................................................................................................done.
Installing pip....
  Complete output from command /Users/evansiegel/In...rawl/venv/bin/python -x /Users/evansiegel/In...env/bin/easy_install /Library/Python/2.7/...ort/pip-1.2.1.tar.gz:
  /Users/evansiegel/Involvio/photo-crawl/venv/bin/python: can't open file '/Users/evansiegel/Involvio/photo-crawl/venv/bin/easy_install': [Errno 2] No such file or directory
----------------------------------------
...Installing pip...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.8.4', 'console_scripts', 'virtualenv')()
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 964, in main
    never_download=options.never_download)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 1076, 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 667, in install_pip
    filter_stdout=_filter_setup)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 1042, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/evansiegel/In...rawl/venv/bin/python -x /Users/evansiegel/In...env/bin/easy_install /Library/Python/2.7/...ort/pip-1.2.1.tar.gz failed with error code 2

似乎由于某种原因virtualenv没有将应该放入的所有内容放入venv/bin文件夹中。现在,只有python和两个别名,python2并且python2.7在那里。

谢谢!

4

1 回答 1

4

我相信这是由旧版本的 virtualenv 和/或 pip 中的错误引起的。看起来您正在使用 virtualenv 1.8.4 和 pip 1.2.1。您是否可以升级到最新的 virtualenv 和 pip(当前 virtualenv 1.9.1 和 pip 1.3.1)?

如果您有安装权限,应该这样做:

pip install pip --upgrade
pip install virtualenv --upgrade

此时运行相同的命令(即sudo virtualenv venv --distribute)应该会给你你想要的。

于 2013-03-22T13:21:39.553 回答