安装Anaconda
- 到Aanconda官网下载对应系统的版本
- 进入安装包所在的目录,比如安装在个人主目录/home/xxx,执行:
$ bash Anaconda2-2018.12-Linux-x86_64.sh
根据提示回答yes或no - 执行命令让.bashrc中添加的路径生效:
$ source ~/.bashrc - 运行python就可以看到已经安装好了,执行
$ which python命令可以查看python路径。
安装Pytorch
- 查看cuda版本:
cat /usr/local/cuda/version.txt - 到PyTorch官网选择对应的配置,执行对应的命令,比如:
conda install pytorch torchvision cuda80 -c pytorch - 安装成功后进入python环境可以查看pytorch版本:
import torch
print(torch.__version__) - 安装指定版本的pytorch
conda install pytorch=0.4.1 -c soumith
安装Tensorflow
注意安装的tensorflow和cuda版本之间的兼容性
-
conda remove tensorflowandpip uninstall tensorflow - 查看有哪些可用的tensorflow版本
conda search --full --name tensorflow-gpu - 安装指定版本
conda install --channel https://conda.anaconda.org/anaconda tensorflow-gpu=1.2.1orpip install tensorflow-gpu==1.14.0 - tensorflow, tensorboard版本经常各种报错怎么办?比如
AttributeError: module tensorflow has no attribute estimatorJust remove them and install again:
pip uninstall tensorboard tensorflow tf-nightly tensorboard-estimator
pip install --upgrade tensorflow-gpu==1.14.0 #会将tensorflow-gpu, tensorboard, tensorflow-estimator 对应版本一起安装, 类似全家桶
使用conda
-
conda --version检查配置是否正确 -
conda info -e查看anaconda中已安装的环境,当前被激活的环境有一个星号标识 -
conda create --name SincNet3 python=3.6创建一个名为SincNet3的环境,指定python版本为3.6 -
conda activate SincNet3进入环境 -
conda deactivate退出环境 -
python --verson查看当前环境的python版本 -
conda install scipy安装某个包 -
conda remove scipy卸载包 -
conda list查看已经安装的包 -
conda remove --name SincNet3 --all删除一个已有的环境
参考:Aanconda使用总结
Ubuntu16.04下安装Aanconda
Attributeerror: module 'tensorflow.python.estimator.estimator_lib' has no attribute 'sessionrunhook'