离线安装Python环境

方法1:新增conda虚拟环境

1. 在有外网的环境下准备需要的python环境

conda create --name your_env_names python=3.x.x

2. 下载并安装第三方库

pip install 包名 --index https://mirrors.ustc.edu.cn/pypi/web/simple/

安装过程中添加清华镜像加速安装过程 --index https://mirrors.ustc.edu.cn/pypi/web/simple/

方法2:已有conda虚拟环境中安装新包

1. pip install 包名 --index https://mirrors.ustc.edu.cn/pypi/web/simple/

2. 查看新增加包的相关依赖

提前安装好pipdeptree,查看包的依赖

pipdeptree -p 新增加包名 -f

eg:查看pandas的依赖

pipdeptree -p pandas -f

pandas==1.0.3
  numpy==1.19.0
  python-dateutil==2.8.2
    six==1.16.0
  pytz==2022.5

3. 新建requirements.txt

把安装包及相关requirements.txt

4. 下载对应的whl包

pip download -d packages -r requirements.txt --index https://mirrors.ustc.edu.cn/pypi/web/simple/

5. 基于requirements.txt和packages安装

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

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值