Anaconda安装、虚拟环境、Pytorch、Tensorflow

1、Anaconda安装

1.1

使用清华镜像进行安装https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/
例如:

wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2023.03-1-Linux-x86_64.sh

1.2

bash Anaconda3-2023.03-1-Linux-x86_64.sh

安装过程中,点击回车和输入yes。

1.3

source ~/.bashrc

2、创建虚拟环境

2.1创建环境

conda create -n pytorch python=3.6

根据需要的python选择版本,版本不是越高越好,选择合适的。

2.2 激活环境

conda activate pytorch

3、安装Pytorch

3.1 更换conda的清华镜像源

使用下面命令查看 .condarc 中的源

conda config --show channels

Linux下将以上配置文件写在 ~/.condarc 中

channels:
  - https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
  - https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults
show_channel_urls: true

切记删除- defaults,否则可能报错。

channels:
  - https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
  - https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
show_channel_urls: true

3. 更换python的清华镜像源

接着是Python换源

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

3.3 官网安装

进入官网https://pytorch.org
选择合适的系统版本、CUDA版本、python版本。
一般使用 pip3 进行安装。

选择 Previous versions of PyTorch进行查看之前版本进行安装。
CUDA版本向下兼容(11.8兼容11.7、11.6等)

3.4 软件包安装

使用conda进行安装:
例:

conda install numpy=1.16.0

4、安装tensorflow

4.1软件包安装

链接:参考博文

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值