gpt4 book ai didi

python - 为 python 3.5 安装 pip

转载 作者:太空狗 更新时间:2023-10-29 20:15:21 25 4
gpt4 key购买 nike

解决方案 我的用户没有 pip 目录的权限,我使用 sudo -H 标志重新安装了 Python 3.5

我正在尝试使用 pip3 为 python 3.5 安装 Tensorflow——原因在 this 中描述。 github 问题——但是当我使用 sudo pip3 install *.whl 安装时,它会安装到 python 3.4。

如何重定向 pip3 以安装到我的 python 3.5 目录?

我在 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

看起来我什至没有为 python 3.5 安装 pip。我该怎么做?

我试过了

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

此外,

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

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

更新

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

根据@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

看来我缺少各种依赖项——我要尝试重新安装

最佳答案

检查:/usr/local/lib/python3.5/dist-packages

你要么在那里有 Pip,要么有 easy_install(Python 设置工具的一部分),它可以用来安装 Pip:

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

或者你可以试试:

python3.5 -m ensurepip

另一个选项是尝试从存储库安装,包名称取决于您的发行版:

sudo apt-get install python3-pip 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

关于python - 为 python 3.5 安装 pip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38249961/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com