gpt4 book ai didi

python - 为什么 PIP 不升级包

转载 作者:行者123 更新时间:2023-11-28 17:38:56 27 4
gpt4 key购买 nike

为什么 pip 没有安装最新版本?有没有办法强制 LATEST?

$ sudo pip install --upgrade pefile
Requirement already up-to-date: pefile in /usr/local/lib/python2.7/dist-packages
Cleaning up...

$ pip show pefile
---
Name: pefile
Version: 1.2.10-114
Location: /usr/local/lib/python2.7/dist-packages
Requires:

$ pip search "pefile"
pefile - Python PE parsing module
INSTALLED: 1.2.10-114
LATEST: 1.2.10-139

$ sudo pip install --upgrade --force-reinstall --pre pefile
Downloading/unpacking pefile
Downloading pefile-1.2.10-114.tar.gz (49kB): 49kB downloaded
Running setup.py (path:/tmp/pip_build_root/pefile/setup.py) egg_info for package pefile

Installing collected packages: pefile
Found existing installation: pefile 1.2.10-114
Uninstalling pefile:
Successfully uninstalled pefile
Running setup.py install for pefile

Successfully installed pefile
Cleaning up...

注意:

$ pip list
pefile (1.2.10-114)
pip (1.5.6)

引用资料: https://code.google.com/p/pefile/

最佳答案

如果您查看 1.2.10-114pefile 页面和 1.2.10-139 - 你会看到一个重要的区别,后者没有带有源和鸡蛋的"file"部分。这意味着文件托管在外部,您需要允许 pip external 安装和 unverified来源:

pip install pefile --upgrade --allow-external=pefile --allow-unverified=pefile

演示:

$ pip show pefile
---
Name: pefile
Version: 1.2.10-114

$ pip install pefile --upgrade --allow-external=pefile --allow-unverified=pefile
pefile an externally hosted file and may be unreliable
pefile is potentially insecure and unverifiable.
...
Installing collected packages: pefile
Found existing installation: pefile 1.2.10-114
Uninstalling pefile:
Successfully uninstalled pefile
Running setup.py install for pefile

Successfully installed pefile
Cleaning up...

$ pip show pefile
---
Name: pefile
Version: 1.2.10-139

关于python - 为什么 PIP 不升级包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27306860/

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