2014-12-05 167 views
2

爲什麼pip不安裝最新?有沒有辦法強制最新?PIP爲什麼不升級包裝

$ 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... 

注:

參考文獻: https://code.google.com/p/pefile/

+0

當一切都失敗,時間緊迫,核彈當前安裝的軟件包。 – smci 2014-12-05 00:50:08

回答

2

如果你看一下pefile1.2.10-1141.2.10-139 - 你會看到一個重要的區別,後者不具備一個「文件」部分的來源和蛋。這意味着,該文件被外部託管,你需要允許pip從一個externalunverified安裝:

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 
+0

非常棒! – shadowbq 2014-12-05 00:56:05