您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關如何離線安裝python的requests庫的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
在可以上網且已經安裝python的機器上檢查requests模塊需要哪些依賴包,如果這些依賴包未安裝,直接安裝requests也不能使用。
使用命令:
pip show requests
發現需要chardet,idna,urllib3,certifi
檢查這幾個包是否已安裝,如果未安裝,則也需要手工安裝。
在網站 https://www.lfd.uci.edu/~gohlke/pythonlibs 上找到相應的程序,下載并傳輸至目標機器。
從github下載requests源碼包并傳輸至目標機器。
https://github.com/kennethreitz/requests
將requests-master.zip解壓到python的安裝目錄中
安裝命令為
pip install xx.whl
下圖中最后一個是正常安裝成功,前面三個有報錯信息,目前暫時忽略,因為經過驗證沒有影響requests安裝。
D:\python-lib>pip install urllib3-1.26.8-py2.py3-none-any.whl Processing d:\python-lib\urllib3-1.26.8-py2.py3-none-any.whl Installing collected packages: urllib3 ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts. We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. requests 2.25.1 requires certifi>=2017.4.17, which is not installed. requests 2.25.1 requires chardet<5,>=3.0.2, which is not installed. requests 2.25.1 requires idna<3,>=2.5, which is not installed. Successfully installed urllib3-1.26.8 D:\python-lib>pip install chardet-4.0.0-py3-none-any.whl Processing d:\python-lib\chardet-4.0.0-py3-none-any.whl Installing collected packages: chardet ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency co nflicts. We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. requests 2.25.1 requires certifi>=2017.4.17, which is not installed. requests 2.25.1 requires idna<3,>=2.5, which is not installed. Successfully installed chardet-4.0.0 D:\python-lib>pip install certifi-2019.11.28-py2.py3-none-any.whl Processing d:\python-lib\certifi-2019.11.28-py2.py3-none-any.whl Installing collected packages: certifi ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency co nflicts. We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. requests 2.25.1 requires idna<3,>=2.5, which is not installed. Successfully installed certifi-2019.11.28 D:\python-lib>pip install idna-2.8-py2.py3-none-any.whl Processing d:\python-lib\idna-2.8-py2.py3-none-any.whl Installing collected packages: idna Successfully installed idna-2.8 D:\python-lib>
在解壓好的equests-master目錄下打開cmd(或者cmd中切換目錄至該路徑)
輸入命令開始安裝
python setup.py install
在python中使用import requests查看
感謝各位的閱讀!關于“如何離線安裝python的requests庫”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。