在我的Ubuntu 16.04桌面上,我安裝了python2.7.12和python3.6.1。Python3 pip3無法安裝請求
[email protected]:~$ python --version
Python 2.7.12
[email protected]:~$ python3 --version
Python 3.6.1
而且我還安裝了pip和pip3。 pip是用於python2並且pip3用於python3的嗎?
那麼,爲什麼地獄PIP的兩個版本顯示我:
[email protected]:~$ pip --version
pip 9.0.1 from /home/seept/.local/lib/python3.5/site-packages (python 3.5)
[email protected]:~$ pip3 --version
pip 9.0.1 from /home/seept/.local/lib/python3.5/site-packages (python 3.5)
爲什麼Python的3.5?
[email protected]:~$ which python
/usr/bin/python
[email protected]:~$ which python3
/usr/local/bin/python3
[email protected]:~$ which pip
/home/seept/.local/bin/pip
[email protected]:~$ which pip3
/home/seept/.local/bin/pip3
所以我真正的問題是,我需要模塊'請求'爲python3項目。
當我運行:
[email protected]:~$ sudo pip3 install requests
這是輸出:
The directory '/home/seept/.cache/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 '/home/seept/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
**Requirement already satisfied: requests in ./.local/lib/python3.5/site-packages**
順便說一句,我總是得到這個消息:
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
所以這個輸出說我使用點校園8.1.1但當我運行pip --version
它說我我正在運行版本9.0.1。
對我來說,它看起來像我已經搞砸了,應該重新安裝所有?
你的'pip'生活在'/ home/seept/.local/bin/pip'中,所以大概你也有Python 3.5安裝或者virtualenv。改爲使用'python3 -m pip'。 –