【发布时间】:2017-05-03 00:56:13
【问题描述】:
我在尝试创建我的 virtualenv 文件夹时遇到问题,因为我的终端说 virtualenv 似乎没有安装。
我做了什么:
sudo pip install virtualenv
回复如下:
The directory '/Users/ricardogonzales/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/ricardogonzales/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
/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading virtualenv-13.1.0-py2.py3-none-any.whl (1.7MB)
100% |████████████████████████████████| 1.7MB 59kB/s
Installing collected packages: virtualenv
Successfully installed virtualenv-13.1.0
之后我运行 virtualenv venv 并收到以下回复:command not found
我已经像周围的其他人一样执行了这个命令 (brew info python),但他们的终端响应与我的不同。
酿造信息响应:
python: stable 2.7.10 (bottled), HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/python.rb
==> Dependencies
Build: pkg-config ✘
Required: openssl ✘
Recommended: readline ✘, sqlite ✘, gdbm ✘
Optional: homebrew/dupes/tcl-tk ✘, berkeley-db4 ✘
==> Options
--universal
Build a universal binary
--with-berkeley-db4
Build with berkeley-db4 support
--with-poll
Enable select.poll, which is not fully implemented on OS X (https://bugs.python.org/issue5154)
--with-quicktest
Run `make quicktest` after the build (for devs; may fail)
--with-tcl-tk
Use Homebrew's Tk instead of OS X Tk (has optional Cocoa and threads support)
--without-gdbm
Build without gdbm support
--without-readline
Build without readline support
--without-sqlite
Build without sqlite support
--HEAD
Install HEAD version
==> Caveats
Pip and setuptools have been installed. To update them
pip install --upgrade pip setuptools
You can install Python packages with
pip install <package>
They will install into the site-package directory
/usr/local/lib/python2.7/site-packages
See: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Homebrew-and-Python.md
我不知道它怎么说“未安装”但是当我运行python --version 我得到Python 2.7.6 但如果我去 usr/local/bin 我看不到任何 python 2.7 或我的东西看到是很多python3。
有什么帮助吗?或尝试解决此问题的建议将不胜感激。
回答:
我已经解决了这个问题,卸载 virtualenv 并再次安装,无需任何额外配置或其他东西。
sudo pip uninstall virtualenv
sudo pip install virtualenv
【问题讨论】:
-
sudo apt-get install virtualenv -
@IanAuld 我忘了告诉我我使用的是 Mac OS X
-
您可能需要注销/登录才能使用它,并使用
mkvirtualenv而不是virtualenv。 -
我不知道有什么不同的东西叫
virtualvenv?它是virtualenv,就像virtual environment。您在整个问题中始终使用额外的“v”来拼写。 -
你能在链接 Python 后发布
which virtualenv和which pip的输出吗(见我的回答)?
标签: python virtualenv