pip识别全局安装包..?!:-(
我用virtualenvwrapper preactivate钩来清洁PYTHONPATH,
export PYTHONPATH=""
Run Code Online (Sandbox Code Playgroud)
然后echo $ PYTHONPATH返回空字符串,但这没有帮助.
怎么了?
bentzy@lama:~$ mkvirtualenv test
New python executable in test/bin/python
Installing setuptools............done.
Installing pip...............done.
virtualenvwrapper.user_scripts creating /home/bentzy/.virtualenvs/test/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/bentzy/.virtualenvs/test/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/bentzy/.virtualenvs/test/bin/preactivate
virtualenvwrapper.user_scripts creating /home/bentzy/.virtualenvs/test/bin/postactivate
virtualenvwrapper.user_scripts creating /home/bentzy/.virtualenvs/test/bin/get_env_details
(test)bentzy@lama:~$ which pip
/home/bentzy/.virtualenvs/test/bin/pip
(test)bentzy@lama:~$ sudo pip install simplejson
Requirement already satisfied (use --upgrade to upgrade): simplejson in /usr/lib /python2.7/dist-packages
Cleaning up...
(test)bentzy@lama:~$ echo $PYTHONPATH
(test)bentzy@lama:~$ pip --version
pip 1.2.1 from /home/bentzy/.virtualenvs/test/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg (python 2.7)
Run Code Online (Sandbox Code Playgroud) 尝试drfdocs在virtualenv中的Mac OSX上安装Python pip包(Django Rest Framework文档):
以下是pip,python,easy_install的相关版本:
$ virtualenv --version
1.11.4
$ mkvirtualenv test
New python executable in test/bin/python
Installing setuptools, pip...done.
(test)$ python --version; which python
Python 2.7.10
/Users/me/.virtualenvs/test/bin/python
(test)$ pip --version; which pip
pip 1.5.4 from /Users/me/.virtualenvs/test/lib/python2.7/site-packages (python 2.7)
/Users/me/.virtualenvs/test/bin/pip
(test)$ easy_install --version; which easy_install
setuptools 2.2
/Users/me/.virtualenvs/test/bin/easy_install
(test)$ python -c "import setuptools.command; print setuptools.command"
<module 'setuptools.command' from '/Users/me/.virtualenvs/test/lib/python2.7/site-packages/setuptools/command/__init__.pyc'>
Run Code Online (Sandbox Code Playgroud)
这是错误:
$ pip install drfdocs
Downloading/unpacking drfdocs
Downloading drfdocs-0.0.11.tar.gz (771kB): 771kB downloaded
Running setup.py (path:/Users/me/.virtualenvs/test/build/drfdocs/setup.py) egg_info for package …Run Code Online (Sandbox Code Playgroud) 我刚刚将我的Mac从Snow Leopard更新为Lion.然后我需要安装virtualenv和virtualenvwrapper.我用过两者easy_install.我还将virtualenvwrapper设置添加到我的.bash_profile文件中,如下所示:
# virtualenvwrapper settings
export WORKON_HOME="~/virtualenvs"
source "/usr/local/bin/virtualenvwrapper.sh"
Run Code Online (Sandbox Code Playgroud)
但在采购时我收到以下错误:
ERROR: Could not create temporary file name. Make sure TMPDIR is set.
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenv has been installed for VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/2.7/bin/python and that PATH is set properly.
Run Code Online (Sandbox Code Playgroud)
感谢大家的帮助.
假设我有一个python解释器,在我的本地系统上安装了许多模块,并且它已被调整为正常工作.
现在我想创建一个virtualenv来冻结它们,这样它们将来不会被升级打破.
我该怎么做?谢谢.
我无法使用pip freeze,因为那是一个没有的集群pip,我没有安装它的权限.而且我也不想重新安装模块,我正在寻找是否有克隆方式.
今天早上,我在Yosemite(10.10.3)的Macbook Pro上遇到了Virtualenv的问题:
$ virtualenv ENV
New python executable in ENV/bin/python2.7
Also creating executable in ENV/bin/python
Installing setuptools, pip, wheel...
Complete output from command /Users/USER/Docu...jp/ENV/bin/python2.7 -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-7.0.3-py2.py3-none-any.whl/pip/__init__.py", line 13, in <module>
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-7.0.3-py2.py3-none-any.whl/pip/utils/__init__.py", line 23, in <module>
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-7.0.3-py2.py3-none-any.whl/pip/_vendor/__init__.py", line 72, in load_module
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-7.0.3-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 967, in <module>
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-7.0.3-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 970, in Environment
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-7.0.3-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 260, in …Run Code Online (Sandbox Code Playgroud) 我使用gnome-terminal和zsh.我最近在打开一个新选项卡(CTRL+ SHIFT+ T)时保持当前工作目录的问题,因为它曾经$HOME每次都重置自己.我通过添加以下内容解决了
. /etc/profile.d/vte.sh
Run Code Online (Sandbox Code Playgroud)
到.zshrc文件.
现在,因为我使用virtualenv(和virtualenvwrapper),我想避免workon virtualenv_name每次打开新标签时都这样做.
显而易见的解决方案是将该命令放入其中.zshrc,但我不想总是输入virtualenv.我想只在我打开一个新标签时才这样做,而且我已经在virtualenv中了.
现在,由于virtualenv中仅仅是一个修饰PATH,PS1和这样的东西,我想我能以某种方式做到这一点.有任何想法吗?
我有virtualenvwrapper需要重新安装PIP作为第一步的问题,我得到关于urllib3一个奇怪的抱怨:
$ python get-pip.py
Traceback (most recent call last):
File "get-pip.py", line 19177, in <module>
main()
File "get-pip.py", line 194, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
import pip
File "/tmp/tmppQTQty/pip.zip/pip/__init__.py", line 16, in <module>
File "/tmp/tmppQTQty/pip.zip/pip/vcs/mercurial.py", line 9, in <module>
File "/tmp/tmppQTQty/pip.zip/pip/download.py", line 39, in <module>
File "/tmp/tmppQTQty/pip.zip/pip/_vendor/requests/__init__.py", line 61, in <module>
File "/tmp/tmppQTQty/pip.zip/pip/_vendor/requests/packages/__init__.py", line 29, in <module>
ImportError: No module named urllib3
Run Code Online (Sandbox Code Playgroud)
当我搜索pip文件时get-pip.py,我没有看到任何对urllib3的引用.
我在机器上有python2.6,py2.7和py3.4
cchilders:~/Downloads
$ which python
/usr/local/bin/python
cchilders:~/Downloads
$ which pip
/usr/local/bin/pip …Run Code Online (Sandbox Code Playgroud) 我正在按照 的安装说明进行操作virtualenvwrapper,描述为here。
我用过pip install virtualenvwrapper,安装在路径上/home/.pyenv/shims/。
但是当我运行命令时
source /home/.pyenv/shims/virtualenvwrapper.sh,整个 Konsole 都会关闭。我之前把命令放在.bashrc文件里,几乎把 Linux 弄坏了,因为 Konsole 打开后会立即崩溃。
我使用的是 Linux OpenSuse 和 Python 3.6.0 版。
任何想法可能导致崩溃?
我知道这which virtualenvwrapper.sh会找到 virtualenvwrapper bash 脚本。
但是,如何确定安装了哪个版本的 virtualenvwrapper?
I am trying to create a virtual environment using mkvirtualenv with python 3 in Windows but the environment is created with python 2.7.My pip version is also from python 2.7 which i have avoided using
py -m pip install virtualenvwrapper-win
Run Code Online (Sandbox Code Playgroud)
When i do
mkvirtualenv test
Run Code Online (Sandbox Code Playgroud)
environment is created with python 2.7 Please help me with a solution Thanks in advance:)
python ×8
virtualenv ×8
macos ×2
pip ×2
django ×1
osx-lion ×1
python-2.7 ×1
python-2.x ×1
python-3.6 ×1
python-3.x ×1
setuptools ×1
zsh ×1