下面是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我试着卸载和重新安装pip和virtualenv,但是这个问题仍然存在。这可能是因为我的Anaconda文件夹目录中都有吗?如有任何帮助或建议,将不胜感激。谢谢。
发布于 2015-07-01 20:39:22
最后,我通过在我的终端中运行以下命令来解决这个问题: www.brew.sh:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"据我所知,它基本上给了我苹果最初没有给我的所有软件包和库。我希望这对任何经历同样问题的人都有帮助。
发布于 2015-07-01 17:00:14
试试这个:
sudo easy_install pip然后:
virtualenv your_virtualenv发布于 2019-10-20 05:28:05
我和@Rafi有同样的问题。在执行后检查错误消息
virtualenv .,我从这条错误信息中得到一条线索:
dyld: Library not loaded: @rpath/libpython3.6m.dylib进行了一些搜索,发现这意味着在此链接的virtualenv和Anaconda之间存在着糟糕的交互。这个简单的解决方案解决了我的问题:
pip uninstall virtualenv
conda install virtualenvhttps://stackoverflow.com/questions/31167229
复制相似问题