Anaconda 安装gpu pytorch tensorflow

Anaconda安装及基础包

  • 直接sh Anaconda3-2020.02-Linux-x86_64.sh
  • 配置清华源
vim /root/.condarc
# 在文件内输入
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
  - defaults
show_channel_urls: true
  • 升级sklearn:pip install --upgrade scikit-learn
  • 安装以下常用包
ipython
numpy
pandas
matplotlib
seaborn
scikit-learn
jupyterlab
xgboost
requests
pymysql
lightgbm
tushare
cython
hmmlearn
tqdm
xlrd
openpyxl
jupyter_contrib_nbextensions
pytest
efficient-apriori
dataclasses
umap-learn
gensim
sqlalchemy
imblearn
bayesian-optimization

安装 pytorch_gpu

1、在官网找到对应命令直接复制粘贴

torch官网

切记不要把后面的-c pytorch去掉,网上说去掉这个就可以使用自己配置的镜像源,但是我去掉后,直接下载了pytorch1.3的cpu版本

2、conda逐步安装pytorch,前面一直用的是镜像源,但是到torch的时候,确实使用官方渠道,速度极慢。此时复制pytorch的版本,然后直接ctrl+c中止,再去https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/下载对应的pytorch版本

版本下载.png

下载后,直接conda install --use-local pytorch-1.6.0-----------
注:此时已经安装成功,直接python进入交互界面

import torch
# 查看版本
torch.__version__
# 查看gpu是否可用
torch.cuda.is_available()

安装tensorflow-gpu

# 建立虚拟环境
conda create -n tf14 python=3.6
# 安装tensorflow
conda activate tf14
conda install tensorflow-gpu=1.14
# 删除虚拟环境
conda remove -n tf14 --all

直接ok,至于cudnn这些东西都不用考虑

question

无法启用nvcc,后续看看怎么整

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容