linux从零开始安装nvidia驱动和tensorflow
来源:互联网 发布:软件技术服务包括什么 编辑:程序博客网 时间:2024/06/07 09:34
安装nvidia驱动和CUDA
- 下载驱动和CUDA安装包,在官网下载对应版本就行
- sudo apt-get install linux-headers-$(uname -r) 或者 linux-headers-generic.否则直接安装会报错 kernel not found
- 安装 nvidia 驱动,一路accept和yes
- 安装 CUDA,一路yes。安装路径:/usr/local/cuda-8.0/。是否安装推荐的驱动, no
最后显示类似下面Summary内容,表示安装成功。 - 在/etc/profile中添加:
export PATH=/usr/local/cuda-8.0/lib64:$PATHexport LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
保存后
# source /etc/profile# nvcc -V 检查CUDA# apt-get install cmake 安装cmake# cd /usr/local/cuda-8.0/samples# make 测试CUDA
测试时间较长,一段没有error即可中止
============ Summary ============Driver: Not SelectedToolkit: Installed in /usr/local/cuda-8.0Samples: Installed in /storage/installers/cuda_samples, but missing recommended librariesPlease make sure that - PATH includes /usr/local/cuda-8.0/bin - LD_LIBRARY_PATH includes /usr/local/cuda-8.0/lib64, or, add /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf and run ldconfig as rootTo uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-8.0/binPlease see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-8.0/doc/pdf for detailed information on setting up CUDA.***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 361.00 is required for CUDA 8.0 functionality to work.To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file: sudo <CudaInstaller>.run -silent -driverLogfile is /tmp/cuda_install_16018.log
安装CUDNN
- 下载cudnn-8.0-linux-x64-v5.1.tgz
- tar -xvzf cudnn-8.0-linux-x64-v5.1.tgz 解压完会有一个cuda文件夹
# cd cuda# cp include/cudnn.h /usr/local/cuda/include# cp lib64/libcudnn.* /usr/local/cuda/lib64
cuDNN安装完成!
有的博客说要建立软链接,但是我没有做,步骤如下:
# cd /usr/local/cuda/lib64 # rm -rf libcudnn.so libcudnn.so.5# ln -s libcudnn.5.1.3 libcudnn.so.5# ln -s libcudnn.so.5 libcudnn.so
首先安装anaconda, 因为很多python库都包含在里面了,一次性安装很方便
安装anaconda
- 从官网下载最新的anaconda安装包,我下的是Anaconda2-4.2.0
- bash Anaconda2-4.2.0-Linux-x86_64.sh
- PREFIX=/usr/share/anaconda2
- # vim /etc/profile (添加环境变量)
export PATH=$PATH:/usr/share/anaconda2/bin
再source /etc/profile生效
修改镜像文件,使得系统默认python为anaconda中的python
# mv /usr/bin/python /usr/bin/python_bk# ln -s /usr/share/anaconda2/bin/python /usr/bin/python
安装h5py
conda install h5py #注意必须先安装anaconda2
这时会提示升级anaconda,yes即可
安装tensorflow
ln -s /usr/anaconda2/bin/pip /usr/bin/pip 建立软连接
github下载 tensorflow_gpu-0.12.0rc0-cp27-none-linux-x86_64.whl
pip install tensorflow_gpu-0.12.0rc0-cp27-none-linux-x86_64.whl
安装完成。测试:
python && import tensorflow 测试tensorflow
或者:
# cd /usr/share/anaconda2/lib/python2.7/site-packages/tensorflow/models/image/mnist# CUDA_VISIBLE_DEVICES = 0(选择显卡) python convolutional.py
开头出现以下字样表示安装成功:
Python 2.7.12 |Anaconda 4.2.0 (64-bit)| (default, Jul 2 2016, 17:42:40) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2Type "help", "copyright", "credits" or "license" for more information.Anaconda is brought to you by Continuum Analytics.Please check out: http://continuum.io/thanks and https://anaconda.org>>> import tensorflow as tfI tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so locallyI tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so locallyI tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so locallyI tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcuda.so.1 locallyI tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so locally
阅读全文
0 0
- linux从零开始安装nvidia驱动和tensorflow
- ubuntu从零开始安装mxnet--安装NVIDIA驱动
- 安装Linux Nvidia显卡驱动
- linux 安装NviDIA显卡驱动
- linux安装Nvidia显卡驱动
- linux安装nvidia显卡驱动(ubuntu和fedora)
- Ubuntu 16.04安装NVIDIA显卡驱动 、CUDA-8.0、cuDNN和TensorFlow问题及解决方法
- ubuntu安装1080ti nvidia驱动+cuda8.0+TensorFlow
- Linux下nvidia驱动的安装技巧
- LINUX的NVIDIA显卡驱动安装
- Linux 下NVIDIA的驱动安装问题
- 在Linux中安装NVIDIA显卡驱动
- [Linux]CentOS 6.0 安装Nvidia显卡驱动
- 干掉Nouveau安装Linux Nvidia显卡驱动
- (转)Linux下安装nvidia驱动
- linux redhat NVIDIA显卡驱动安装
- linux mint 13安装Nvidia显卡驱动
- linux系统安装nvidia显卡驱动
- 关于angular-webSQL的使用
- mac Tomacat 安装步骤
- Python 数组[],元组(),字典{}的异同
- 求期望方差
- java中的队列
- linux从零开始安装nvidia驱动和tensorflow
- Konva.js 专门对canvas的一个插件
- JSTL标签
- iOS-性能分析
- JZ2440 串口分析
- jquery通过name获取到所有的value并且构造一个数据传到后台
- Vuforia的学习(四)ImageTarget的配置
- Android 文件下载三种基本方式
- 商品展示案例