最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Python離線安裝第三方庫詳細(xì)操作流程

 更新時(shí)間:2023年11月13日 10:19:09   作者:胡八一  
在使用Python開發(fā)過程中,我們經(jīng)常需要使用各種第三方庫來擴(kuò)展Python的功能,這篇文章主要給大家介紹了關(guān)于Python離線安裝第三方庫的相關(guān)資料,需要的朋友可以參考下

1、場景介紹

在一些服務(wù)器上,我們搭建完Python環(huán)境之后,因?yàn)榉?wù)器的網(wǎng)絡(luò)限制原因,不能直接通過pip命令下載安裝Python的依賴包。
因此,我們需要在可以正常上網(wǎng)的服務(wù)器上下載好所需的依賴包文件,然后拷貝到目標(biāo)服務(wù)器,通過pip在目標(biāo)服務(wù)器上進(jìn)行安裝。

2、準(zhǔn)備requirements.txt文件

requirements.txt文件羅列的是依賴包列表,表示你要下載的依賴包以及對應(yīng)的版本。
該文件可以通過兩種方式創(chuàng)建,分別是pip命令創(chuàng)建和手工創(chuàng)建。

jupyter==1.0.0
notebook==6.1.0

(1)pip命令創(chuàng)建requirements.txt,可以把當(dāng)前服務(wù)器的Python依賴包生成列表到requirements.txt文件中。
【pip list】
【pip freeze >requirements.txt】

(2)手工創(chuàng)建requirements.txt,直接新建一個(gè)requirements.txt文件,然后按照格式填寫所需依賴包以及對應(yīng)版本號。

3、下載依賴包

注意:該步驟需要在可以正常上網(wǎng)的服務(wù)器上下載。下載的依賴包文件如圖2所示。

pip download -r requirements.txt -d packages/ -i https://pypi.tuna.tsinghua.edu.cn/simple

其中:(packages/是要生成的文件夾,存放下載的依賴包文件;https://pypi.tuna.tsinghua.edu.cn/simple是鏡像源地址)。

4、安裝依賴包

準(zhǔn)備好依賴包之后,就可以在無法使用pip命令下載安裝依賴包的目標(biāo)服務(wù)器上進(jìn)行安裝了。

使用命令之前,需要把packsges文件夾、requirements.txt文件拷貝到目標(biāo)服務(wù)器,下面以requests依賴包為例。

pip install --no-index --find-links=./packages -r ./requirements.txt

(其中:./packsges是依賴包的所在路徑;./requirements.txt是依賴包的列表路徑)。

D:\zjj\pip>pip list
Package                           Version
--------------------------------- ---------
anyio                             3.7.1
argon2-cffi                       21.3.0
argon2-cffi-bindings              21.2.0
arrow                             1.2.3
asttokens                         2.2.1
async-lru                         2.0.4
attrs                             23.1.0
Babel                             2.12.1
backcall                          0.2.0
beautifulsoup4                    4.12.2
bleach                            6.0.0
certifi                           2023.7.22
cffi                              1.15.1
charset-normalizer                3.2.0
colorama                          0.4.6
comm                              0.1.3
debugpy                           1.6.7
decorator                         5.1.1
defusedxml                        0.7.1
distlib                           0.3.7
exceptiongroup                    1.1.2
executing                         1.2.0
fastjsonschema                    2.18.0
filelock                          3.12.2
fqdn                              1.5.1
idna                              3.4
importlib-metadata                6.8.0
importlib-resources               6.0.0
ipykernel                         6.25.0
ipython                           8.12.2
ipython-genutils                  0.2.0
ipywidgets                        8.0.7
isoduration                       20.11.0
jedi                              0.19.0
Jinja2                            3.1.2
json5                             0.9.14
jsonpointer                       2.4
jsonschema                        4.18.4
jsonschema-specifications         2023.7.1
jupyter_client                    8.3.0
jupyter-console                   6.6.3
jupyter-contrib-core              0.4.2
jupyter_core                      5.3.1
jupyter-events                    0.6.3
jupyter-highlight-selected-word   0.2.0
jupyter-lsp                       2.2.0
jupyter-nbextensions-configurator 0.6.3
jupyter_server                    2.7.0
jupyter_server_terminals          0.4.4
jupyterlab                        4.0.3
jupyterlab-pygments               0.2.2
jupyterlab_server                 2.24.0
jupyterlab-widgets                3.0.8
lxml                              4.9.3
MarkupSafe                        2.1.3
matplotlib-inline                 0.1.6
mistune                           3.0.1
nbclient                          0.8.0
nbconvert                         7.7.3
nbformat                          5.9.1
nest-asyncio                      1.5.7
notebook                          7.0.0
notebook_shim                     0.2.3
overrides                         7.3.1
packaging                         23.1
pandocfilters                     1.5.0
parso                             0.8.3
pickleshare                       0.7.5
pip                               23.2.1
pipenv                            2023.7.23
pkgutil_resolve_name              1.3.10
platformdirs                      3.10.0
prometheus-client                 0.17.1
prompt-toolkit                    3.0.39
psutil                            5.9.5
pure-eval                         0.2.2
pycparser                         2.21
Pygments                          2.15.1
python-dateutil                   2.8.2
python-json-logger                2.0.7
pytz                              2023.3
pywin32                           306
pywinpty                          2.0.11
PyYAML                            6.0.1
pyzmq                             25.1.0
qtconsole                         5.4.3
QtPy                              2.3.1
referencing                       0.30.0
requests                          2.31.0
rfc3339-validator                 0.1.4
rfc3986-validator                 0.1.1
rpds-py                           0.9.2
Send2Trash                        1.8.2
setuptools                        68.0.0
six                               1.16.0
sniffio                           1.3.0
soupsieve                         2.4.1
stack-data                        0.6.2
terminado                         0.17.1
tinycss2                          1.2.1
tomli                             2.0.1
tornado                           6.3.2
traitlets                         5.9.0
typing_extensions                 4.7.1
uri-template                      1.3.0
urllib3                           2.0.4
virtualenv                        20.24.2
virtualenv-clone                  0.5.7
wcwidth                           0.2.6
webcolors                         1.13
webencodings                      0.5.1
websocket-client                  1.6.1
widgetsnbextension                4.0.8
zipp                              3.16.2

D:\zjj\pip>pip install --no-index --find-links=./packages -r ./requirements.txt
Looking in links: ./packages
Processing d:\zjj\pip\packages\requests-2.28.2-py3-none-any.whl (from -r ./requirements.txt (line 1))
Requirement already satisfied: charset-normalizer<4,>=2 in d:\environment\python\python3.8.10\lib\site-packages (from requests==2.28.2->-r ./requirements.txt (line 1)) (3.2.0)
Requirement already satisfied: idna<4,>=2.5 in d:\environment\python\python3.8.10\lib\site-packages (from requests==2.28.2->-r ./requirements.txt (line 1)) (3.4)
Processing d:\zjj\pip\packages\urllib3-1.26.16-py2.py3-none-any.whl (from requests==2.28.2->-r ./requirements.txt (line 1))
Requirement already satisfied: certifi>=2017.4.17 in d:\environment\python\python3.8.10\lib\site-packages (from requests==2.28.2->-r ./requirements.txt (line 1)) (2023.7.22)
Installing collected packages: urllib3, requests
  Attempting uninstall: urllib3
    Found existing installation: urllib3 2.0.4
    Uninstalling urllib3-2.0.4:
      Successfully uninstalled urllib3-2.0.4
  Attempting uninstall: requests
    Found existing installation: requests 2.31.0
    Uninstalling requests-2.31.0:
      Successfully uninstalled requests-2.31.0
Successfully installed requests-2.28.2 urllib3-1.26.16

D:\zjj\pip>pip list
Package                           Version
--------------------------------- ---------
anyio                             3.7.1
argon2-cffi                       21.3.0
argon2-cffi-bindings              21.2.0
arrow                             1.2.3
asttokens                         2.2.1
async-lru                         2.0.4
attrs                             23.1.0
Babel                             2.12.1
backcall                          0.2.0
beautifulsoup4                    4.12.2
bleach                            6.0.0
certifi                           2023.7.22
cffi                              1.15.1
charset-normalizer                3.2.0
colorama                          0.4.6
comm                              0.1.3
debugpy                           1.6.7
decorator                         5.1.1
defusedxml                        0.7.1
distlib                           0.3.7
exceptiongroup                    1.1.2
executing                         1.2.0
fastjsonschema                    2.18.0
filelock                          3.12.2
fqdn                              1.5.1
idna                              3.4
importlib-metadata                6.8.0
importlib-resources               6.0.0
ipykernel                         6.25.0
ipython                           8.12.2
ipython-genutils                  0.2.0
ipywidgets                        8.0.7
isoduration                       20.11.0
jedi                              0.19.0
Jinja2                            3.1.2
json5                             0.9.14
jsonpointer                       2.4
jsonschema                        4.18.4
jsonschema-specifications         2023.7.1
jupyter_client                    8.3.0
jupyter-console                   6.6.3
jupyter-contrib-core              0.4.2
jupyter_core                      5.3.1
jupyter-events                    0.6.3
jupyter-highlight-selected-word   0.2.0
jupyter-lsp                       2.2.0
jupyter-nbextensions-configurator 0.6.3
jupyter_server                    2.7.0
jupyter_server_terminals          0.4.4
jupyterlab                        4.0.3
jupyterlab-pygments               0.2.2
jupyterlab_server                 2.24.0
jupyterlab-widgets                3.0.8
lxml                              4.9.3
MarkupSafe                        2.1.3
matplotlib-inline                 0.1.6
mistune                           3.0.1
nbclient                          0.8.0
nbconvert                         7.7.3
nbformat                          5.9.1
nest-asyncio                      1.5.7
notebook                          7.0.0
notebook_shim                     0.2.3
overrides                         7.3.1
packaging                         23.1
pandocfilters                     1.5.0
parso                             0.8.3
pickleshare                       0.7.5
pip                               23.2.1
pipenv                            2023.7.23
pkgutil_resolve_name              1.3.10
platformdirs                      3.10.0
prometheus-client                 0.17.1
prompt-toolkit                    3.0.39
psutil                            5.9.5
pure-eval                         0.2.2
pycparser                         2.21
Pygments                          2.15.1
python-dateutil                   2.8.2
python-json-logger                2.0.7
pytz                              2023.3
pywin32                           306
pywinpty                          2.0.11
PyYAML                            6.0.1
pyzmq                             25.1.0
qtconsole                         5.4.3
QtPy                              2.3.1
referencing                       0.30.0
requests                          2.28.2
rfc3339-validator                 0.1.4
rfc3986-validator                 0.1.1
rpds-py                           0.9.2
Send2Trash                        1.8.2
setuptools                        68.0.0
six                               1.16.0
sniffio                           1.3.0
soupsieve                         2.4.1
stack-data                        0.6.2
terminado                         0.17.1
tinycss2                          1.2.1
tomli                             2.0.1
tornado                           6.3.2
traitlets                         5.9.0
typing_extensions                 4.7.1
uri-template                      1.3.0
urllib3                           1.26.16
virtualenv                        20.24.2
virtualenv-clone                  0.5.7
wcwidth                           0.2.6
webcolors                         1.13
webencodings                      0.5.1
websocket-client                  1.6.1
widgetsnbextension                4.0.8
zipp                              3.16.2

D:\zjj\pip>

總結(jié)

到此這篇關(guān)于Python離線安裝第三方庫的文章就介紹到這了,更多相關(guān)Python離線安裝第三方庫內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 利用Python爬取可用的代理IP

    利用Python爬取可用的代理IP

    我們平時(shí)在用Python爬蟲時(shí),有時(shí)會(huì)要用到IP代理。網(wǎng)上有很多的免費(fèi)代理IP網(wǎng)站,但不是所有的ip都能用,所以這篇文章教大家如何爬取可用的代理IP。
    2016-08-08
  • 解決pycharm修改代碼后第一次運(yùn)行不生效的問題

    解決pycharm修改代碼后第一次運(yùn)行不生效的問題

    這篇文章主要介紹了解決pycharm修改代碼后第一次運(yùn)行不生效的問題,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-02-02
  • 深入了解Python?Opencv數(shù)據(jù)增強(qiáng)

    深入了解Python?Opencv數(shù)據(jù)增強(qiáng)

    常見的數(shù)據(jù)增強(qiáng)操作有:按比例放大或縮小圖片、旋轉(zhuǎn)、平移、水平翻轉(zhuǎn)、改變圖像通道等。本文將通過Python?OpenCV實(shí)現(xiàn)這些操作,需要的可以參考一下
    2022-02-02
  • 解決python運(yùn)行效率不高的問題

    解決python運(yùn)行效率不高的問題

    在本篇文章中小編給大家分享了關(guān)于解決python運(yùn)行效率不高的問題,有需要的朋友們可以跟著學(xué)習(xí)下。
    2020-07-07
  • Python lxml庫的簡單介紹及基本使用講解

    Python lxml庫的簡單介紹及基本使用講解

    lxml是XML和HTML的解析器,其主要功能是解析和提取XML和HTML中的數(shù)據(jù),本文重點(diǎn)給大家介紹Python lxml庫的簡單介紹及基本使用講解,感興趣的朋友跟隨小編一起看看吧
    2020-12-12
  • Python生成驗(yàn)證碼實(shí)例

    Python生成驗(yàn)證碼實(shí)例

    這篇文章主要介紹了Python生成驗(yàn)證碼的方法,具有很好的實(shí)用價(jià)值,代碼結(jié)構(gòu)清晰易懂,需要的朋友可以參考下
    2014-08-08
  • python使用ctypes調(diào)用dll遇到的坑解決記錄

    python使用ctypes調(diào)用dll遇到的坑解決記錄

    這篇文章主要為大家介紹了python使用ctypes調(diào)用dll遇到的坑解決記錄,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-12-12
  • Python實(shí)現(xiàn)運(yùn)行其他程序的四種方式實(shí)例分析

    Python實(shí)現(xiàn)運(yùn)行其他程序的四種方式實(shí)例分析

    這篇文章主要介紹了Python實(shí)現(xiàn)運(yùn)行其他程序的四種方式,結(jié)合實(shí)例形式分析了Python執(zhí)行其他程序相關(guān)模塊與函數(shù)使用技巧,需要的朋友可以參考下
    2017-08-08
  • python高階函數(shù)map()和reduce()實(shí)例解析

    python高階函數(shù)map()和reduce()實(shí)例解析

    這篇文章主要介紹了python高階函數(shù)map()和reduce()實(shí)例解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-03-03
  • Python+OpenCV自制AI視覺版貪吃蛇游戲

    Python+OpenCV自制AI視覺版貪吃蛇游戲

    這篇文章為大家詳細(xì)介紹了如何使用mediapipe+opencv自制AI視覺版的貪吃蛇小游戲,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以學(xué)習(xí)一下
    2022-03-03

最新評論

巴南区| 江门市| 九龙城区| 东方市| 汽车| 吴江市| 肇东市| 井冈山市| 桃江县| 湘潭县| 当阳市| 高安市| 荣成市| 梨树县| 通渭县| 伊吾县| 南岸区| 浦城县| 任丘市| 横山县| 濮阳县| 南和县| 库车县| 永城市| 彰武县| 崇信县| 河池市| 永和县| 天水市| 胶州市| 大荔县| 常州市| 凯里市| 四子王旗| 沿河| 武隆县| 太谷县| 遂川县| 水城县| 吴忠市| 任丘市|