问题一、
参考链接:
https://stackoverflow.com/questions/41890549/tensorflow-cannot-open-libcuda-so-1
报错log如下:
I tensorflow/stream_executor/dso_loader.cc:105] Couldn't open CUDA library libcuda.so.1. LD_LIBRARY_PATH: /home/yaoming/pycharm-community/bin:
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:160] hostname: yaoming-ThinkPad-T470p
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:185] libcuda reported version is: Not found: was unable to find libcuda.so DSO loaded into this program
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:189] kernel reported version is: Permission denied: could not open driver version path for reading: /proc/driver/nvidia/version
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1080] LD_LIBRARY_PATH: /home/yaoming/pycharm-community/bin:
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1081] failed to find libcuda.so on this system: Failed precondition: could not dlopen DSO: libcuda.so.1; dlerror: libnvidia-fatbinaryloader.so.375.39: cannot open shared object file: No such file or directory
解决方法:
bcuda.so.1 is a symlink to a file that is specific to the version of your NVIDIA drivers. It may be pointing to the wrong version or it may not exi# See where the link is pointing.
ls /usr/lib/x86_64-linux-gnu/libcuda.so.1 -la
lrwxrwxrwx 1 root root 19 Feb 22 20:40 \
/usr/lib/x86_64-linux-gnu/libcuda.so.1 -> ./libcuda.so.375.39
Make sure it is pointing to the right version.
Compare it with the installed NVIDIA driver.
nvidia-smi
Replace libcuda.so.1 with a link to the correct version/usr/lib/x86_64-linux-gnu
sudo ln -f -s libcuda.so.
Using TensorFlow backend.
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:105] Couldn't open CUDA library libcudnn.so. LD_LIBRARY_PATH:
I tensorflow/stream_executor/cuda/cuda_dnn.cc:3448] Unable to load cuDNN DSO
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally
X_train shape: (60000, 28, 28, 1)
60000 train samples
解决方法:
1、
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda
2、
You can also add these commands to the end of your ~/.bashrc so they get executed next time you login.
3、确保已经做过以下操作
First of all, please make sure that you have already installed cudnn. The installation should be done separately after the installation of Cuda.
Then you need to find your path of 'libcudnn.so.' by:
sudo find /usr/ -name 'libcudnn.so'
For me, I got /usr/local/cuda-8.0/targets/x86_64-linux/lib.
You need also find your path where the libraries could be found by using the well-loaded library such as libcufft.so
sudo find /usr/ -name 'libcufft.so'
For me, I got /usr/lib.
Now copy the files to right place:
sudo cp /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcud* /usr/lib
Quit the previous Tensorflow session and start a new one et to test. It works for me :)
问题三:
SyntaxError: Non-ASCII character '\xe5
解决方法:
Python默认编码错误SyntaxError: Non-ASCII character ‘\xe5’之解决方法
在编写Python时,当使用中文输出或注释时运行脚本,会提示错误信息:
SyntaxError: Non-ASCII character ‘\xe5’ in file *
解决方法:
python的默认编码文件是用的ASCII码,你将文件存成了UTF-8!!!(文件中存在中文或者其他语言,就会出现此问题!)
解决办法很简单!!!
在文件开头加入:
# -*- coding: UTF-8 -*-
或者 #coding=utf-8
(注:此语句一定要添加在源代码的第一行)