Python程序教程

您现在的位置是:首页 >  python下载

当前栏目

下载whl文件,离线方式安装numpy包_python离线安装pip

离线,安装,下载,whl,文件,方式,numpy,python,pip
2025-03-13 21:27:27 时间

大家好,又见面了,我是你们的朋友全栈君。

1、下载whl离线文件到本地,放到c盘根目录(任意位置均可,只是方便安装)

https://pypi.org/

https://www.lfd.uci.edu/~gohlke/pythonlibs/(推荐用这个地址下载whl文件,国内源,速度快。ctrl+f找到自己需要的文件)

2、 cmd到存放whl文件的目录

3、pip安装whl离线文件

pip install ****.whl

(****.whl是我们下载的whl的文件名称)

二、批量下载(使用requirements.txt文件,适用于公司为内网环境,可以先从外网下载,再拷贝到内网安装)

1、pip freeze > requirements.txt

2、配置pip(pip安装速度快的可以忽略这一步)

①在C:\Users\<你的电脑用户名>\ 新建一个文件夹 pip

②在新建的pip目录新建一个 pip.ini 文件,内容如下

[global]

index-url = https://mirrors.aliyun.com/pypi/simple/ extra-index-url = https://pypi.douban.com/simple/ timeout = 120

3、(请注意cmd当前路径需包含requirements.txt文件)

先使用如下命令将包下载到本地(两条命令都需要执行,第二条命令是对第一条命令的补充),此次是下载到dir目录中

pip wheel -w DIR -r requirements.txt

pip download -d DIR -r requirements.txt

再将requirements.txt和dir目录拷贝到离线环境,再使用这条命令安装即可

pip install –no-index –find-links=DIR -r requirements.txt

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/179145.html原文链接:https://javaforall.cn