Installeer PIP voor Python 3.5

Oplossing Mijn gebruiker heeft geen machtigingen gehandeld op de PIP-directory, ik heb Python 3.5 opnieuw geïnstalleerd met behulp van de sudo -Hvlag

Ik probeer Tensorflow voor Python 3.5 te installeren met PIP3 – om redenen beschreven in Dit GitHub-probleem – maar wanneer ik installeer met behulp van sudo pip3 install *.whlhet installeert in Python 3.4.

Hoe kan ik doorverwijzen pip3om in My Python 3.5-directory te installeren?

Ik heb op Ubuntu 14.04

kendall@kendall-Macmini:~/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)
kendall@kendall-Macmini:~/Downloads$ python3.5 -m pip --version
/usr/local/bin/python3.5: No module named pip

Het lijkt erop dat ik niet eens PIP heb geïnstalleerd voor Python 3.5. Hoe kan ik dit doen?

Ik heb

geprobeerd

kendall@kendall-Macmini:~/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

ook,

kendall@kendall-Macmini:~/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

Ik kan geen ondersteuning vinden voor het upgraden naar PIP3.5

update

kendall@kendall-Macmini:~/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.
kendall@kendall-Macmini:~/Downloads$ sudo python3.5 easy_install.py pip
python3.5: can't open file 'easy_install.py': [Errno 2] No such file or directory
kendall@kendall-Macmini:~/Downloads$ python3.5 -m ensurepip
Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS
kendall@kendall-Macmini:~/Downloads$ sudo apt-get install pip3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package pip3
kendall@kendall-Macmini:~/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.
kendall@kendall-Macmini:~/Downloads$ python3.5 -m ensurepip
Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS

Zoals aanbevolen door @fwalsh

kendall@kendall-Macmini:~/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

Het lijkt alsof ik allerlei afhankelijkheden mis — ik ga proberen opnieuw te installeren


Antwoord 1, autoriteit 100%

Controleer: /usr/local/lib/python3.5/dist-packages

Je hebt Pip daar of easy_install (onderdeel van Pythons setup-tools), die kan worden gebruikt om Pip te installeren:

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

Of je kunt het proberen:

python3.5 -m ensurepip

Een andere optie is proberen te installeren vanuit een repository, de pakketnaam hangt af van uw distributie:

sudo apt-get install python3-pip pip3

Bewerken:Probeer deze correctie voor eenvoudige installatie:

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

Ik neem aan dat dit de map is waarin het is geïnstalleerd.

Je mist ook deze bibliotheek voor de opdracht python3.5 -m ensurepip:

sudo apt-get install libssl-dev

Antwoord 2

Probeer

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.8 python3.8-dev python3.8-venv
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
python3 -V

Other episodes