https://blog.csdn.net/weixin_42270433/article/details/96476178
3.再次查看,可看到图形那里,已经显示出显卡的型号。
4.在终端输入命令:nvidia-smi,可看到安装的显卡驱动型号
系统默认Python版本为2.7,需要更改python版本,终端命令操作如下:
$cd /usr/bin
$sudo rm -rf python
$sudo ln -s /usr/bin/python3 /usr/bin/python
sudo apt-get install python3-pip
发现无法安装pip3,解决办法:
sudo apt-get --fix-broken install
pip install -U pip
sudo apt-get install python3-pip
pip install --upgrade pip
1.Cuda下载地址:
https://developer.nvidia.com/cuda-toolkit-archive
2.Cuda安装命令:
1.$sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604-9-0-local-cublas-performance-update_1.0-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-2_1.0-1_amd64.deb
2.$apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
3.$sudo apt-get update
4.$apt-get install cuda
3.查看Cuda是否安装成功及安装版本:
5.$cat /usr/local/cuda-9.0/version.txt
4.遇到files list file for package ‘libeigen3-dev’ missing; assuming package has no files currently installed的解决方法
sudo apt-get update
sudo apt-get install --reinstall libeigen3-dev
sudo dpkg -i <package.deb>
sudo dpkg -i
3.出现如下问题:
4. 解决办法:需要下载这两个deb文件,先运行Runtime Library,再运行Developer Library;
$ sudo cp /usr/include/cudnn.h /usr/local/cuda-9.0/include
sudo cp /var/lib/dpkg/info/libcudnn* /usr/local/cuda-9.0/lib64
sudo chmod a+r /usr/local/cuda-9.0/include/cudnn.h /usr/local/cuda-9.0/lib64/libcudnn*
cat /usr/local/cuda-9.0/include/cudnn.h | grep CUDNN_MAJOR -A 2
按照自己按照的路径情况,修改配置文件,修改前,尽量先备份原始的配置文件。
$ sudo gedit /.bash_profile
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64:/usr/local/cuda-9.0/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda-9.0
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64
保存退出,在终端输入
source /.bash_profile
更新当前环境变量。
sudo apt-get install python3-pip python3-dev python-virtualenv
virtualenv --system-site-packages -p python3 /home/zhai/App/tensorflow
source /home/zhai/App/tensorflow/bin/activate
pip3 install tensorflow-gpu==1.9.0 Collecting tensorflow-gpu==1.9.0
5.通过Virtualenv环境安装,每次使用TensorFlow都要先激活Virtualenv环境:
source /home/zhai/App/tensorflow/bin/activate
6.测试tensorflow是否安装成功
(tensorflow)wz@WZ-Desktop:
∼$python
>>>import tensorflow as tf
>>> a = tf.constant([1.0,2.0,3.0,4.0,5.0,6.0],shape=[2,3],name='a')
>>> b = tf.constant([1.0,2.0,3.0,4.0,5.0,6.0],shape=[3,2],name='b')
>>> c = tf.matmul(a,b)
>>> sess =tf.Session(config=tf.ConfigProto(log_device_placement=True))
>>> print(sess.run(c))
ubuntu16.04系统为pycharm并配置tensorflow环境:新建project—>file—>settings—>project Interpreter—>设置python版本(tensorflow安装的路径里的python)