問題描述:
已經安裝的Python版本為3.6.1, 在公司網絡環境運行.
CMD中安裝第三方模塊pyperclip時候, 報錯'No matching distribution found for pyperclip'.
如下:
C:\Users\Csnow\AppData\Local\Programs\Python\Python36\Scripts>pip install py perclip Collecting pyperclip Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connec tion broken by 'ConnectTimefoutError(<pip._vendor.requests.packages.urllib3.conne ction.VerifiedHTTPSConnection object at 0x0000000003BB5A20>, 'Connection to pypi .python.org timed out. (connect timeout=15)')': /simple/pyperclip/ Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connec tion broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.conne ction.VerifiedHTTPSConnection object at 0x0000000003BB5B70>, 'Connection to pypi .python.org timed out. (connect timeout=15)')': /simple/pyperclip/ Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connec tion broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.conne ction.VerifiedHTTPSConnection object at 0x0000000003BB5C18>, 'Connection to pypi .python.org timed out. (connect timeout=15)')': /simple/pyperclip/ Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connec tion broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.conne ction.VerifiedHTTPSConnection object at 0x0000000003BB5860>, 'Connection to pypi .python.org timed out. (connect timeout=15)')': /simple/pyperclip/ Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connec tion broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.conne ction.VerifiedHTTPSConnection object at 0x0000000003BB54E0>, 'Connection to pypi .python.org timed out. (connect timeout=15)')': /simple/pyperclip/ Could not find a version that satisfies the requirement pyperclip (from versio ns: ) No matching distribution found for pyperclip
解決思路:
使用ping命令發現所有包都timeout, 說明可能防火牆攔截, CMD數據傳輸沒通過網頁瀏覽器的proxy.
更換網絡連接, 選擇不經過公司防火牆的網絡(例如手機熱點), 問題解決, pip成功安裝且出現升級提示.
C:\Users\Csnow\AppData\Local\Programs\Python\Python36\Scripts>pip install py perclip Collecting pyperclip Downloading pyperclip-1.6.0.tar.gz Installing collected packages: pyperclip Running setup.py install for pyperclip ... done Successfully installed pyperclip-1.6.0 You are using pip version 9.0.1, however version 9.0.3 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' comm and.
Python IDLE中運行導入該模塊的命令成功(沒有出現報錯).
>>> import pyperclip
>>>
