2016-07-07 106 views
6

解決方法安裝PIP我的用戶沒有自己的權限點子目錄,我重新安裝的Python 3.5使用sudo -H標誌爲Python 3.5

我試圖安裝Tensorflow爲Python 3.5使用PIP 3 - 原因在this github問題描述 - 但是當我安裝使用sudo pip3 install *.whl它安裝到python 3.4。

如何將pip3重定向到我的python 3.5目錄?

我在Ubuntu 14.04

[email protected]:~/Downloads$ python3.4 -m pip --version 
pip 8.1.2 from /usr/local/lib/python3.4/dist-packages/pip-8.1.2-py3.4.egg (python 3.4) 
[email protected]:~/Downloads$ python3.5 -m pip --version 
/usr/local/bin/python3.5: No module named pip 

運行它看起來像我甚至不已經安裝了蟒蛇3.5點子。我怎樣才能做到這一點?

我已經試過

[email protected]:~/Downloads$ pip install -U pip 
Requirement already up-to-date: pip in /usr/local/lib/python3.4/dist-packages/pip-8.1.2-py3.4.egg 

此外,

[email protected]:~/Downloads$ whereis pip 
pip: /usr/bin/pip /usr/bin/X11/pip /usr/local/bin/pip3.4 /usr/local/bin/pip /usr/local/bin/pip2.7 /usr/share/man/man1/pip.1.gz 

我找不到任何升級支持pip3.5

UPDATE

[email protected]:~/Downloads$ sudo apt-get install python3-setuptools 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
python3-setuptools is already the newest version. 
The following packages were automatically installed and are no longer required: 
    libntdb1 linux-headers-4.2.0-27 linux-headers-4.2.0-27-generic 
    linux-image-4.2.0-27-generic linux-image-extra-4.2.0-27-generic 
    linux-signed-image-4.2.0-27-generic python-ntdb 
Use 'apt-get autoremove' to remove them. 
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded. 
[email protected]:~/Downloads$ sudo python3.5 easy_install.py pip 
python3.5: can't open file 'easy_install.py': [Errno 2] No such file or directory 
[email protected]:~/Downloads$ python3.5 -m ensurepip 
Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS 
[email protected]:~/Downloads$ sudo apt-get install pip3 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
E: Unable to locate package pip3 


[email protected]:~/Downloads$ sudo apt-get install libssl-dev 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
libssl-dev is already the newest version. 
The following packages were automatically installed and are no longer required: 
    libntdb1 linux-headers-4.2.0-27 linux-headers-4.2.0-27-generic 
    linux-image-4.2.0-27-generic linux-image-extra-4.2.0-27-generic 
    linux-signed-image-4.2.0-27-generic python-ntdb 
Use 'apt-get autoremove' to remove them. 
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded. 
[email protected]:~/Downloads$ python3.5 -m ensurepip 
Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS 

所推薦的@fwalsh

[email protected]:~/Downloads$ python3.5 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 
zipimport.ZipImportError: can't decompress data; zlib not available 

好像我錯過了各種各樣的依賴 - 我要去嘗試重新安裝

+0

https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py – fwalch

+0

'pip已經是最新的' –

+0

@fwalch我添加了更新,它似乎我缺少各種各樣的依賴關係 - 將嘗試重新安裝3.5 –

回答

8

檢查:/usr/local/lib/python3.5/ DIST-包

你要麼有皮普有或使用easy_install(蟒蛇設置工具的一部分),它可以用來安裝PIP:

sudo apt-get install python3-setuptools 
sudo python3.5 easy_install.py pip 

或者你可以嘗試:

python3.5 -m ensurepip 

另一種選擇是試圖從系統信息庫安裝:

sudo apt-get install pip3 

編輯:試試這個校正安裝方便:

sudo apt-get install python3-setuptools 
sudo python3.5 /usr/local/lib/python3.5/dist-packages/easy_install.py pip 

我假設,就是它的安裝目錄至。

而且,你錯過了這個庫的python3.5 -m ensurepip命令:

sudo apt-get install libssl-dev 
+0

在帖子中添加了更新。我開始認爲我的python 3.5安裝出錯了。我應該重新安裝嗎? –

+0

再次更新,再次,我的python 3.5安裝有問題嗎?大聲笑 –

+0

你是從倉庫安裝它還是自己編譯它? –