Django VirtualEnv设置 - 'setuptools pip wheel失败,错误代码为-11'

时间:2015-07-01 16:47:15

标签: python django pip virtualenv

我正在关注Django的设置教程,我必须在我的文件夹中设置虚拟环境。我没有virtualenv,所以我做了sudo pip install virtualenv并在安装后收到了此消息:

Chriss-MacBook-Air:trydjango18 cnowak7$ sudo pip install virtualenv
The directory '/Users/cnowak7/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/cnowak7/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting virtualenv
  Downloading virtualenv-13.1.0-py2.py3-none-any.whl (1.7MB)
    100% |████████████████████████████████| 1.7MB 120kB/s 
Installing collected packages: virtualenv
Successfully installed virtualenv-13.1.0

在此之后,我尝试使用virtualenv .创建一个类似教程的虚拟环境,并得到了这个异常输出:

Chriss-MacBook-Air:trydjango18 cnowak7$ virtualenv .
Using base prefix '/Users/cnowak7/anaconda'
New python executable in ./bin/python3
Also creating executable in ./bin/python
Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/Users/cnowak7/anaconda/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/Users/cnowak7/anaconda/lib/python3.4/site-packages/virtualenv.py", line 832, in main
    symlink=options.symlink)
  File "/Users/cnowak7/anaconda/lib/python3.4/site-packages/virtualenv.py", line 1004, in create_environment
    install_wheel(to_install, py_executable, search_dirs)
  File "/Users/cnowak7/anaconda/lib/python3.4/site-packages/virtualenv.py", line 969, in install_wheel
    'PIP_NO_INDEX': '1'
  File "/Users/cnowak7/anaconda/lib/python3.4/site-packages/virtualenv.py", line 910, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/cnowak7/Deskt...django18/bin/python3 -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code -11

所以我试着看看这个错误是否会影响我在教程中的进度,所以当我运行source bin/activate时,我收到了这个错误:

Chriss-MacBook-Air:trydjango18 cnowak7$ source bin/activate
-bash: bin/activate: No such file or directory

我尝试卸载并重新安装pipvirtualenv,但此问题仍然存在。这可能是因为我的Anaconda文件夹目录中包含了所有内容吗?任何帮助或建议将不胜感激。感谢。

3 个答案:

答案 0 :(得分:1)

我最终通过访问www.brew.sh并在我的终端中运行以下命令解决了这个问题:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

根据我的理解,它基本上给了我所有的Apple和我最初没有给我的软件包和库。我希望这对遇到同样问题的其他人有帮助。

答案 1 :(得分:0)

试试这个:

sudo easy_install pip

然后:

virtualenv your_virtualenv

答案 2 :(得分:0)

我和@Rafi有同样的问题。在执行后检查错误消息后

virtualenv .

,我从此错误消息中得到了一个线索:

dyld: Library not loaded: @rpath/libpython3.6m.dylib

进行了一些搜索,发现这意味着this link处virtualenv和Anaconda之间的交互不良。这个简单的解决方案解决了我的问题:

pip uninstall virtualenv
conda install virtualenv