2015-07-01 58 views
2

我正在按照Django的设置教程,我必须在我的文件夹中设置一个虚拟环境。我没有virtualenv,所以我也sudo pip install virtualenv和得到这个消息时,它被安装后:Django VirtualEnv设置 - 'setuptools pip wheel失败,错误代码-11'

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文件夹目录中的每一个?任何帮助或建议,将不胜感激。谢谢。

+0

试试这个:'pip install setuptools --no-use-wheel --upgrade' – doniyor

+0

我试过这个没有运气。这是我得到的错误: – Rafi

+0

Chriss-MacBook-Air:〜cnowak7 $ pip install setuptools --no-use-wheel --upgrade Traceback(最近调用最后一次): 文件“/ Users/cnowak7/anaconda/bin/pip“,第5行, from pkg_resources import load_entry_point ImportError:没有名为'pkg_resources'的模块 – Rafi

回答

1

我结束了前往www.brew.sh和我的终端运行以下命令来解决这个问题:

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

从我的理解,它基本上给了我所有的包和库,我错过了苹果d idn't原本给我。我希望这有助于任何遇到同样问题的人。

0

试试这个:

sudo easy_install pip 

然后:

virtualenv your_virtualenv 
+0

如果我再次安装pip和virtualenv,我应该先卸载它们吗? – Rafi

+0

@Rafi是的,更好;) – doniyor

+0

我得到'sudo:apt-get:command not found'。我查了一下,有人说Mac-OSX显然没有这个命令。 – Rafi

相关问题