一,cpu 下安装
tensorflow
conda env list
source activate tensorflow
直接安装相应版本
python
import tensorflow as tf
tf.__version__ 1.11.0
keras 直接安装
conda env list
source activate keras
import keras 2.2.2
print(keras.__version__)
import tensorflow as tf
tf.__version__
pytorch
import torch
print(torch.__version__)
print(torch.cuda.device_count())
print(torch.cuda.is_available())
cntk
/root/anaconda3/bin/conda env list
source activate cntk-py35
python 3.5.6
export PATH=/root/anaconda3/bin:$PATH
python -c "import cntk; print(cntk.__version__)"
theano
caffe2
python 3.6.9
import caffe2
安装
conda create -n caffe2 python=3.6
conda activate caffe2
conda install pytorch-nightly-cpu -c pytorch -n caffe2
python -c ‘from caffe2.python import core‘ 2>/dev/null && echo "Success" || echo "Failure"
报错:
pip install protobuf
pip install future
参考官网安装即可
gpu
tensorflow-gpu:1.11.0 python 3.5
export PATH=/root/anaconda3/bin:$PATH
source activate tensorflow
keras
export PATH=/root/anaconda3/bin:$PATH
conda env list
source activate keras
python3.5
nvidia-docker run -it --rm pytorch-gpu:1.1.0 /bin/bash
pytorch
[[email protected] /]# python
Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 19:07:31)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import torch
print(torch.__version__)
1.1.0
print(torch.cuda.device_count())
1
print(torch.cuda.is_available())
True
cntk
source activate cntk-py35 python3.5
python -c "import cntk; print(cntk.__version__)"
2.4
theano
gpu-theano-in-use:1.0.4 python2.7
source activate theano
python test.py
import theano
/root/anaconda3/envs/theano/lib/python2.7/site-packages/theano/gpuarray/dnn.py:184: UserWarning: Your cuDNN version is more recent than Theano. If you encounter problems, try updating Theano or downgrading cuDNN to a version >= v5 and <= v7.
warnings.warn("Your cuDNN version is more recent than "
Using cuDNN version 7603 on context None
Mapped name None to device cuda: GeForce GTX 960M (0000:01:00.0)
theano.__version__
u‘1.0.4‘
https://www.jianshu.com/p/4cc75a79dce9
Linux下安装miniconda
在官网下载miniconda3
执行:bash Miniconda3-latest-Linux-x86_64.sh
-vim ~/.bashrc
-export PATH=~/anaconda3/bin:$PATH
-source ~/.bashrc
创建虚拟环境并安装theano
基于python2.7创建一个名为theano的环境
conda create --name theano python=2.7
进入虚拟环境: source activate theano
-使用conda安装:conda install numpy scipy mkl
pip install parameterized
conda install theano pygpu
-使用pip安装:pip install Theano
测试参考官网文档
caffe2
看官网文档安装
https://caffe2.ai/docs/getting-started.html?platform=ubuntu&configuration=compile
https://blog.csdn.net/qq_35451572/article/details/79428167
cmake
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.0
-DCUDNN_ROOT_DIR=/usr/local/cuda
To check if Caffe2 build was successful
python -c ‘from caffe2.python import core‘ 2>/dev/null && echo "Success" || echo "Failure"
To check if Caffe2 GPU build was successful
This must print a number > 0 in order to use Detectron
python -c ‘from caffe2.python import workspace; print(workspace.NumCudaDevices())‘
参考
https://blog.csdn.net/Yan_Joy/article/details/70241319
https://www.nvidia.com/en-gb/data-center/gpu-accelerated-applications/caffe2/
https://blog.csdn.net/qq_35451572/article/details/79428167
https://blog.csdn.net/qq_16525279/article/details/79724728
https://blog.csdn.net/y_f_raquelle/article/details/83278953
https://www.cnblogs.com/nanzhao/p/9596844.html
附:conda常用
- conda env list 或 conda info -e 查看当前存在哪些虚拟环境
- conda update conda 检查更新当前conda
- conda update --all 更新本地已安装的包
- conda create -n your_env_name python=X.X(2.7、3.6等) anaconda 命令创建python版本为X.X、名字为your_env_name的虚拟环境。your_env_name文件可以在Anaconda安装目录envs文件下找到。
- Windows: activate your_env_name(虚拟环境名称) 激活虚拟环境
- conda install -n your_env_name [package] 安装package到your_env_name中
- linux: source deactivate Windows: deactivate 关闭虚拟环境
- conda remove -n your_env_name(虚拟环境名称) --all 删除虚拟环境
- conda remove --name your_env_name package_name 删除环境中的某个
原文地址:https://www.cnblogs.com/g2thend/p/11516029.html