首页 > 解决方案 > 在没有互联网连接的情况下安装 python 包

问题描述

我需要在没有互联网接入的机器上安装带有 pip 的 python 包。为此,我尝试从以下链接下载这些软件包:https://www.lfd.uci.edu/~gohlke/pythonlibs/ 我认为 whl 文件是完整的软件包,但是当我尝试使用 pip 安装时,我得到了以下错误

点安装 .\pyproj-3.2.1-cp310-cp310-win_amd64.whl

        WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewC
    onnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000000F76ABA6EC0>: Failed to establish a new
     connection: [WinError 10061] No connection could be made because the target machine actively refused it')': 

ERROR: Could not find a version that satisfies the requirement certifi (from pyproj) (from versions: none)
ERROR: No matching distribution found for certifi

我需要安装的软件包是:

我也尝试在具有互联网连接的本地计算机上使用 pip 下载,但是当我尝试使用生成的 whl 时,我遇到了同样的问题

我应该如何继续安装这些软件包?

标签: pythonpip

解决方案


像这样

pip install --no-index --find-links=<lolcal-folder> <package-name>

例如

pip install --no-index --find-link=/tmp/python-wheels exchangelib

更多信息在这里


推荐阅读