2013-02-02 78 views
5

pip認可全球安裝軟件包..?! :-(pip - 要求已滿足?

我用virtualenvwrapper預激活鉤清理PYTHONPATH,

export PYTHONPATH="" 

然後回顯$ PYTHONPATH返回空字符串,但這並沒有幫助。

怎麼了?

[email protected]:~$ 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)[email protected]:~$ which pip 
/home/bentzy/.virtualenvs/test/bin/pip 
(test)[email protected]:~$ sudo pip install simplejson 
Requirement already satisfied (use --upgrade to upgrade): simplejson in /usr/lib /python2.7/dist-packages 
Cleaning up... 
(test)[email protected]:~$ echo $PYTHONPATH 

(test)[email protected]:~$ 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) 
+0

我沒有用過virtualenvwrapper,但我的virtualenv使用--no-site-packages中選擇。 mkvirtualenv可以通過這個選項嗎? –

+0

是的 - 但這不是問題。從virtualenv 1.7開始,--no-site-packages已成爲默認值,並且已被棄用。我使用1.8.2。 無論如何 - 我也試過了,仍然沒有像預期的那樣工作...... – bentzy

+0

嘗試打印'sys.path'並看看裏面有什麼。 – Aman

回答

9

您正在使用sudo安裝simplejson,但如果您使用的是sudo,則可能會更改您的$PATH,而且似乎是 問題。

只需使用pip install simplejson(不包括sudo),它可能會起作用。

僅當您想影響整個系統時才使用sudo

+0

正是!謝謝。 – bentzy

1

已經滿意意味着你已經安裝了「it」。

嘗試: PIP卸載simplejson

然後: PIP安裝simplejson

相關問題