conda环境移植方法(linux)

目录

安装anaconda

conda环境迁移

换apt源

安装pycharm用作调试

批量下载安装包


安装anaconda


运行

sh Anaconda3-2021.05-Linux-x86_64.sh

输入

echo 'export PATH="/home/fjyy/anaconda3/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

配置好环境变量
创建新环境

conda create -n dahua python=3.8

新环境离线情况无法创建,需要采用离线迁移的办法


conda环境迁移

在在线环境中拷贝环境

压缩环境包

tar -zcvf /public/home/***/pkg.tar.gz(压缩包路径)  /public/home/***/software/anaconda3/pkgs(压

缩文件夹路径)
压缩pkgs包,可以进annaconda里面压缩
解压

tar -zcvf 压缩包名称 压缩文件名称

在离线环境中

tar -zxvf .tar.gz
conda create --name new_env --clone ~/anaconda3/envs/your_env/  --offline
conda env list  #查看conda环境
conda activate new_env  #激活conda环境,自行测试环境移植是否满足使用要求

在线环境中把需要的包都装下载好,在离线环境就能直接安装了

换apt源

sudo gedit /etc/apt/sources.list


打开apt下载源,给里面都删了
18.04换成这个

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

换完后,输入

sudo apt-get update
sudo apt-get upgrade

更换源完成


安装pycharm用作调试


输入

tar -zxvf pycharm.tar.gz

解压
在根目录下进入conda环境运行

./pycharm.sh

在设置中选择创建桌面快捷方式

批量下载安装包


批量下载安装pip需要的库
清华源

-i https://pypi.tuna.tsinghua.edu.cn/simple some-package

下载需要的包

pip download -d DIR -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
pip wheel -w DIR -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

都要有,确保依赖关系完整
批量安装

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

DIR文件要和requirements.txt放在一起,只会安装requirements.txt里面有的包

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值