我正在尝试使用pip在本地安装软件包.它曾经使用--user但现在当我尝试它时,它找到包的版本,/usr/local/lib/然后不在本地安装它.通常情况下,将安装在的东西~/.local,但现在它只是检查包装上的系统级目录,如果它的存在,它不安装它(这是不是我想要的),如果它不存在,它会尝试安装它在/usr/local/lib其中我没有写权限.例如:
$ pip install --user rpy2
Requirement already satisfied (use --upgrade to upgrade): rpy2 in /usr/local/lib/python2.7/dist-packages/
Run Code Online (Sandbox Code Playgroud)
如何使pip install --user总是转到~/.local而不是系统范围的目录?
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)