溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

怎么在Python3中安裝Requests模塊

發布時間:2021-03-17 17:27:20 來源:億速云 閱讀:826 作者:Leah 欄目:開發技術

今天就跟大家聊聊有關怎么在Python3中安裝Requests模塊,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。

操作系統:Windows Server 2012 x64

python3安裝

官網下載最新的適合windows 的安裝包。

下載下來的python-3.7.4-amd64.exe,直接拷貝到測試環境的機器上,雙擊安裝即可,需要注意的是,最好勾選 AddPython 3.7 to PATH,這樣后期直接在cmd窗口中就可以調用python命令了。

requests模塊的依賴包檢查

在可以上網且已安裝python的機器上檢查requests模塊需要哪些依賴包,要是沒有依賴包,直接下載一個直接安裝最好。

在CMD命令窗口中輸入 pip show requests

C:\Users\Laycher>pip show requests
Name: requests
Version: 2.18.4
Summary: Python HTTP for Humans.
Home-page: http://python-requests.org
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: Apache 2.0
Location: d:\program files\python3\lib\site-packages
Requires: chardet, urllib3, idna, certifi
Required-by:

下載依賴包模塊和requests模塊

certifi-2019.9.11-py2.py3-none-any.whl

chardet-3.0.4-py2.py3-none-any.whl

idna-2.8-py2.py3-none-any.whl

requests-2.22.0-py2.py3-none-any.whl

urllib3-1.25.6-py2.py3-none-any.whl

安裝模塊

將以上下載的文件傳到測試環境。離線裝模塊。

安裝命令為 pip install XXXXX.whl

切記,先安裝依賴包,如果直接安裝requests,由于有依賴包,還是會去連外網找依賴包。

D:\軟件>pip install certifi-2019.9.11-py2.py3-none-any.whl
Processing d:\軟件\certifi-2019.9.11-py2.py3-none-any.whl
Installing collected packages: certifi
Successfully installed certifi-2019.9.11
D:\軟件>pip install chardet-3.0.4-py2.py3-none-any.whl
Processing d:\軟件\chardet-3.0.4-py2.py3-none-any.whl
Installing collected packages: chardet
Successfully installed chardet-3.0.4
D:\軟件>pip install idna-2.8-py2.py3-none-any.whl
Processing d:\軟件\idna-2.8-py2.py3-none-any.whl
Installing collected packages: idna
Successfully installed idna-2.8
D:\軟件>pip install urllib3-1.25.6-py2.py3-none-any.whl
Processing d:\軟件\urllib3-1.25.6-py2.py3-none-any.whl
Installing collected packages: urllib3
Successfully installed urllib3-1.25.6
D:\軟件>pip install requests-2.22.0-py2.py3-none-any.whl
Processing d:\軟件\requests-2.22.0-py2.py3-none-any.whl
Requirement already satisfied: idna in c:\users\administrator\appdata\local\prog
rams\python\python37\lib\site-packages (from requests==2.22.0) (2.8)
Requirement already satisfied: chardet in c:\users\administrator\appdata\local\p
rograms\python\python37\lib\site-packages (from requests==2.22.0) (3.0.4)
Requirement already satisfied: urllib3 in c:\users\administrator\appdata\local\p
rograms\python\python37\lib\site-packages (from requests==2.22.0) (1.25.6)
Requirement already satisfied: certifi in c:\users\administrator\appdata\local\p
rograms\python\python37\lib\site-packages (from requests==2.22.0) (2019.9.11)
Installing collected packages: requests
Successfully installed requests-2.22.0

看完上述內容,你們對怎么在Python3中安裝Requests模塊有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女