TensorFlow 2.4.1安装 (解决Centos8.2 安装tensorflow 2.4.1过程中遇到libcudart.so.11.0和libcuda.so.1等问题)

安装TensorFlow

https://tensorflow.google.cn/install?hl=zh_cn

TensorFlow 2.4.1安装 (解决Centos8.2 安装tensorflow 2.4.1过程中遇到libcudart.so.11.0和libcuda.so.1等问题)_第1张图片
TensorFlow 2.4.1安装 (解决Centos8.2 安装tensorflow 2.4.1过程中遇到libcudart.so.11.0和libcuda.so.1等问题)_第2张图片

[root@cpanel python]# pip3 -V
pip 20.2.3 from /usr/local/python3/lib/python3.9/site-packages/pip (python 3.9)
[root@cpanel python]# python3 -V
Python 3.9.1

系统当前的Python版本是3.9.1 pip版本20.2.3

安装Python 3.8

下载源代码
[root@cpanel python]# wget https://www.python.org/ftp/python/3.8.7/Python-3.8.7.tgz
--2021-02-10 11:13:56--  https://www.python.org/ftp/python/3.8.7/Python-3.8.7.tgz
正在解析主机 www.python.org (www.python.org)... 151.101.228.223, 2a04:4e42:1a::223
正在连接 www.python.org (www.python.org)|151.101.228.223|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:24468684 (23M) [application/octet-stream]
正在保存至: “Python-3.8.7.tgz”

Python-3.8.7.tgz                100%[======================================================>]  23.33M   432KB/s  用时 55s     

2021-02-10 11:14:52 (434 KB/s) - 已保存 “Python-3.8.7.tgz” [24468684/24468684])
解压包
[root@cpanel python]# ls
Python-3.8.7.tgz
[root@cpanel python]# tar -zxvf Python*.tgz
[root@cpanel python]# ls
Python-3.8.7  Python-3.8.7.tgz
[root@cpanel python]# 
编译安装
[root@cpanel python]# cd Python-3.8.7
[root@cpanel Python-3.8.7]# ls
aclocal.m4          config.sub    Doc      install-sh  m4               Misc     Parser   Programs       README.rst
CODE_OF_CONDUCT.md  configure     Grammar  Lib         Mac              Modules  PC       pyconfig.h.in  setup.py
config.guess        configure.ac  Include  LICENSE     Makefile.pre.in  Objects  PCbuild  Python         Tools
[root@cpanel Python-3.8.7]# ./configure prefix=/usr/local/python3.8
[root@cpanel Python-3.8.7]# make && make install

.
.
.

Looking in links: /tmp/tmp1viy7ym2
Processing /tmp/tmp1viy7ym2/setuptools-49.2.1-py3-none-any.whl
Processing /tmp/tmp1viy7ym2/pip-20.2.3-py2.py3-none-any.whl
Installing collected packages: setuptools, pip
  WARNING: The script easy_install-3.8 is installed in '/usr/local/python3.8/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts pip3 and pip3.8 are installed in '/usr/local/python3.8/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.2.3 setuptools-49.2.1
cd /usr/local/python3.8/bin

[root@cpanel bin]# ls
2to3      easy_install-3.8  idle3.8  pip3.8  pydoc3.8  python3.8         python3-config
2to3-3.8  idle3             pip3     pydoc3  python3   python3.8-config
创建软链接
[root@cpanel bin]# ln -s -f /usr/local/python3.8/bin/pip3.8 /usr/local/bin/pip3.8
[root@cpanel bin]# pip3.8  -V
pip 20.2.3 from /usr/local/python3.8/lib/python3.8/site-packages/pip (python 3.8)
[root@cpanel bin]# ln -s -f /usr/local/python3.8/bin/pip3.8 /usr/local/bin/pip
[root@cpanel bin]# ln -s -f /usr/local/python3.8/bin/pip3.8 /usr/bin/pip
[root@cpanel bin]# pip  -V
pip 20.2.3 from /usr/local/python3.8/lib/python3.8/site-packages/pip (python 3.8)
[root@cpanel bin]# ln -s -f /usr/local/python3.8/bin/python3.8 /usr/bin/python3.8
[root@cpanel bin]# python3.8 -V
Python 3.8.7
[root@cpanel bin]# ln -s -f /usr/local/python3.8/bin/python3.8 /usr/bin/python
[root@cpanel bin]# which python
/usr/bin/python
[root@cpanel bin]# python -V
Python 3.8.7
测试Python
[root@cpanel ~]# python
Python 3.8.7 (default, Feb 10 2021, 11:26:06) 
[GCC 5.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 1 + 1
2
>>> 
>>> exit();
升级 pip
[root@cpanel ~]# # pip install --upgrade pip
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting pip
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 5.1 MB/s 
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.2.3
    Uninstalling pip-20.2.3:
      Successfully uninstalled pip-20.2.3
Successfully installed pip-21.0.1
[root@cpanel ~]# pip -V
pip 21.0.1 from /usr/local/python3.8/lib/python3.8/site-packages/pip (python 3.8)
安装tensorflow
[root@cpanel ~]# pip install tensorflow
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting tensorflow
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/ac/9b/3fdbce9195fe53adbab1a930ee95a957af18c34a83ae5b1145f3cf8da409/tensorflow-2.4.1-cp38-cp38-manylinux2010_x86_64.whl (394.4 MB)
     |████████████████████████████████| 394.4 MB 260 kB/s 
Collecting wheel~=0.35
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Collecting gast==0.3.3
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/d6/84/759f5dd23fec8ba71952d97bcc7e2c9d7d63bdc582421f3cd4be845f0c98/gast-0.3.3-py2.py3-none-any.whl (9.7 kB)
Collecting tensorflow-estimator<2.5.0,>=2.4.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/74/7e/622d9849abf3afb81e482ffc170758742e392ee129ce1540611199a59237/tensorflow_estimator-2.4.0-py2.py3-none-any.whl (462 kB)
     |████████████████████████████████| 462 kB 52.9 MB/s 
Collecting grpcio~=1.32.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/47/e2/a8516f907bcb7e641f05528b3e661dbb7149ac68478e992eb86afd3cdeeb/grpcio-1.32.0-cp38-cp38-manylinux2014_x86_64.whl (3.8 MB)
     |████████████████████████████████| 3.8 MB 17.5 MB/s 
Collecting six~=1.15.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting keras-preprocessing~=1.1.2
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/79/4c/7c3275a01e12ef9368a892926ab932b33bb13d55794881e3573482b378a7/Keras_Preprocessing-1.1.2-py2.py3-none-any.whl (42 kB)
     |████████████████████████████████| 42 kB 34.2 MB/s 
Collecting h5py~=2.10.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/9d/4f/46dbeea4aee767e15725950b6aac2c56c4eff9e5044886aa7ef932319476/h5py-2.10.0-cp38-cp38-manylinux1_x86_64.whl (2.9 MB)
     |████████████████████████████████| 2.9 MB 25.3 MB/s 
Collecting opt-einsum~=3.3.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/bc/19/404708a7e54ad2798907210462fd950c3442ea51acc8790f3da48d2bee8b/opt_einsum-3.3.0-py3-none-any.whl (65 kB)
     |████████████████████████████████| 65 kB 68.9 MB/s 
Collecting astunparse~=1.6.3
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/2b/03/13dde6512ad7b4557eb792fbcf0c653af6076b81e5941d36ec61f7ce6028/astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Collecting typing-extensions~=3.7.4
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/60/7a/e881b5abb54db0e6e671ab088d079c57ce54e8a01a3ca443f561ccadb37e/typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Collecting protobuf>=3.9.2
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/3e/b2/e4099c78e483e7a612d67eeb0c8740ce15cdeba4a0032da121c791f7d352/protobuf-3.14.0-cp38-cp38-manylinux1_x86_64.whl (1.0 MB)
     |████████████████████████████████| 1.0 MB 44.1 MB/s 
Collecting wrapt~=1.12.1
  Using cached wrapt-1.12.1-cp38-cp38-linux_x86_64.whl
Collecting tensorboard~=2.4
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/64/21/eebd23060763fedeefb78bc2b286e00fa1d8abda6f70efa2ee08c28af0d4/tensorboard-2.4.1-py3-none-any.whl (10.6 MB)
     |████████████████████████████████| 10.6 MB 18.7 MB/s 
Collecting flatbuffers~=1.12.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/eb/26/712e578c5f14e26ae3314c39a1bdc4eb2ec2f4ddc89b708cf8e0a0d20423/flatbuffers-1.12-py2.py3-none-any.whl (15 kB)
Collecting absl-py~=0.10
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/bc/58/0aa6fb779dc69cfc811df3398fcbeaeefbf18561b6e36b185df0782781cc/absl_py-0.11.0-py3-none-any.whl (127 kB)
     |████████████████████████████████| 127 kB 94.4 MB/s 
Collecting numpy~=1.19.2
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/66/d7/3b133b17e185f14137bc8afe7a41daf1f31556900f10238312a5ae9c7345/numpy-1.19.5-cp38-cp38-manylinux2010_x86_64.whl (14.9 MB)
     |████████████████████████████████| 14.9 MB 18.2 MB/s 
Collecting termcolor~=1.1.0
  Using cached termcolor-1.1.0-py3-none-any.whl
Collecting google-pasta~=0.2
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/a3/de/c648ef6835192e6e2cc03f40b19eeda4382c49b5bafb43d88b931c4c74ac/google_pasta-0.2.0-py3-none-any.whl (57 kB)
     |████████████████████████████████| 57 kB 63.2 MB/s 
Collecting werkzeug>=0.11.15
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/cc/94/5f7079a0e00bd6863ef8f1da638721e9da21e5bacee597595b318f71d62e/Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
     |████████████████████████████████| 298 kB 90.7 MB/s 
Requirement already satisfied: setuptools>=41.0.0 in /usr/local/python3.8/lib/python3.8/site-packages (from tensorboard~=2.4->tensorflow) (49.2.1)
Collecting tensorboard-plugin-wit>=1.6.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/1a/c1/499e600ba0c618b451cd9c425ae1c177249940a2086316552fee7d86c954/tensorboard_plugin_wit-1.8.0-py3-none-any.whl (781 kB)
     |████████████████████████████████| 781 kB 85.9 MB/s 
Collecting markdown>=2.6.8
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/ac/ef/24a91ca96efa0d7802dffb83ccc7a3c677027bea19ec3c9ee80be740408e/Markdown-3.3.3-py3-none-any.whl (96 kB)
     |████████████████████████████████| 96 kB 74.4 MB/s 
Collecting google-auth-oauthlib<0.5,>=0.4.1
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/81/67/e2c34bb0628984c7ce71cce6ba6964cb29c418873847fc285f826e032e6e/google_auth_oauthlib-0.4.2-py2.py3-none-any.whl (18 kB)
Collecting requests<3,>=2.21.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/29/c1/24814557f1d22c56d50280771a17307e6bf87b70727d975fd6b2ce6b014a/requests-2.25.1-py2.py3-none-any.whl (61 kB)
     |████████████████████████████████| 61 kB 74.8 MB/s 
Collecting google-auth<2,>=1.6.3
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/7f/90/58d541b95c501063dc3cee96e2ae87660e264f97e8cbb0887cffb627211b/google_auth-1.25.0-py2.py3-none-any.whl (116 kB)
     |████████████████████████████████| 116 kB 91.8 MB/s 
Collecting pyasn1-modules>=0.2.1
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/95/de/214830a981892a3e286c3794f41ae67a4495df1108c3da8a9f62159b9a9d/pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
     |████████████████████████████████| 155 kB 96.2 MB/s 
Collecting rsa<5,>=3.1.4
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/bf/87/dc7a6ebf0afbc602548627fa48e9c1147fa187233bf71d4c51c76a2cfb27/rsa-4.7-py3-none-any.whl (34 kB)
Collecting cachetools<5.0,>=2.0.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/bb/72/8df2e0dc991f1a1d2c6869404e7622e8ee50d80bff357dbb57c3df70305b/cachetools-4.2.1-py3-none-any.whl (12 kB)
Collecting requests-oauthlib>=0.7.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/a3/12/b92740d845ab62ea4edf04d2f4164d82532b5a0b03836d4d4e71c6f3d379/requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB)
Collecting pyasn1<0.5.0,>=0.4.6
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/62/1e/a94a8d635fa3ce4cfc7f506003548d0a2447ae76fd5ca53932970fe3053f/pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
     |████████████████████████████████| 77 kB 74.2 MB/s 
Collecting chardet<5,>=3.0.2
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/19/c7/fa589626997dd07bd87d9269342ccb74b1720384a4d739a1872bd84fbe68/chardet-4.0.0-py2.py3-none-any.whl (178 kB)
     |████████████████████████████████| 178 kB 84.8 MB/s 
Collecting urllib3<1.27,>=1.21.1
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/23/fc/8a49991f7905261f9ca9df5aa9b58363c3c821ce3e7f671895442b7100f2/urllib3-1.26.3-py2.py3-none-any.whl (137 kB)
     |████████████████████████████████| 137 kB 94.5 MB/s 
Collecting idna<3,>=2.5
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl (58 kB)
     |████████████████████████████████| 58 kB 68.4 MB/s 
Collecting certifi>=2017.4.17
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/5e/a0/5f06e1e1d463903cf0c0eebeb751791119ed7a4b3737fdc9a77f1cdfb51f/certifi-2020.12.5-py2.py3-none-any.whl (147 kB)
     |████████████████████████████████| 147 kB 85.3 MB/s 
Collecting oauthlib>=3.0.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/05/57/ce2e7a8fa7c0afb54a0581b14a65b56e62b5759dbc98e80627142b8a3704/oauthlib-3.1.0-py2.py3-none-any.whl (147 kB)
     |████████████████████████████████| 147 kB 90.4 MB/s 
Installing collected packages: urllib3, pyasn1, idna, chardet, certifi, six, rsa, requests, pyasn1-modules, oauthlib, cachetools, requests-oauthlib, google-auth, wheel, werkzeug, tensorboard-plugin-wit, protobuf, numpy, markdown, grpcio, google-auth-oauthlib, absl-py, wrapt, typing-extensions, termcolor, tensorflow-estimator, tensorboard, opt-einsum, keras-preprocessing, h5py, google-pasta, gast, flatbuffers, astunparse, tensorflow
Successfully installed absl-py-0.11.0 astunparse-1.6.3 cachetools-4.2.1 certifi-2020.12.5 chardet-4.0.0 flatbuffers-1.12 gast-0.3.3 google-auth-1.25.0 google-auth-oauthlib-0.4.2 google-pasta-0.2.0 grpcio-1.32.0 h5py-2.10.0 idna-2.10 keras-preprocessing-1.1.2 markdown-3.3.3 numpy-1.19.5 oauthlib-3.1.0 opt-einsum-3.3.0 protobuf-3.14.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-2.25.1 requests-oauthlib-1.3.0 rsa-4.7 six-1.15.0 tensorboard-2.4.1 tensorboard-plugin-wit-1.8.0 tensorflow-2.4.1 tensorflow-estimator-2.4.0 termcolor-1.1.0 typing-extensions-3.7.4.3 urllib3-1.26.3 werkzeug-1.0.1 wheel-0.36.2 wrapt-1.12.1
用官方示例测试
python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
[root@cpanel ~]# python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
2021-02-10 13:25:15.870342: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2021-02-10 13:25:15.870374: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2021-02-10 13:25:18.641471: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-02-10 13:25:18.641606: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2021-02-10 13:25:18.641616: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
2021-02-10 13:25:18.641631: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (cpanel.xn--8zr900a.cn): /proc/driver/nvidia/version does not exist
2021-02-10 13:25:18.641872: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-02-10 13:25:18.641966: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
tf.Tensor(-636.62915, shape=(), dtype=float32)

解决 ibcudart.so.11.0

我们需要安装cuda

wget https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux.run

这个文件太大网络抖动等原因会导致下载中断,我们给wget增加参数让其增强下载

wget -t 0 -c -b <downloadurl>

-b 后台模式 -c 断点续传 -t 重试次数(tries)默认次数为20 0表示一直重试直至下载完成

增强下载
[root@cpanel i-data]# wget -t 0 -c -b https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux.run
继续在后台运行,pid 为 48846。
将把输出写入至 “wget-log”。
[root@cpanel i-data]# tail -f wget-log
    50K .......... .......... .......... .......... ..........  0%  100K 9h40m
   100K .......... .......... .......... .......... ..........  0% 65.1K 11h18m
   150K .......... .......... .......... .......... ..........  0% 22.9K 18h49m
   200K .......... .......... .......... .......... ..........  0% 39.6K 19h51m
   250K .......... .......... .......... .......... ..........  0% 12.9K 28h46m
   300K .......... .......... .......... .......... ..........  0% 20.3K 31h21m
   350K .......... .......... .......... .......... ..........  0% 24.4K 32h17m
   400K .......... .......... .......... .......... ..........  0% 17.1K 34h50m
   450K .......... .......... .......... .......... ..........  0% 24.5K 35h14m

由于下载速度太慢实在不敢恭维,这里本地下载安装包后分包为多个小包同时上传服务器以便节省时间

压缩并分包,包大小为256m
$ tar czf - cuda_11.1.0_455.23.05_linux.run | split -b 256m -a 1 - cuda_11.1.0_455.23.05_linux.run.tar.gz_
通过scp命令上传
$ scp ./cuda_11.1.0_455.23.05_linux.run.tar.gz_* root@<youripaddress>:~/

提示:反向或位置对调就是下载

[root@cpanel ~]# ls
cuda_11.1.0_455.23.05_linux.run.tar.gz_a
cuda_11.1.0_455.23.05_linux.run.tar.gz_b
cuda_11.1.0_455.23.05_linux.run.tar.gz_c
cuda_11.1.0_455.23.05_linux.run.tar.gz_d
cuda_11.1.0_455.23.05_linux.run.tar.gz_e
cuda_11.1.0_455.23.05_linux.run.tar.gz_f
cuda_11.1.0_455.23.05_linux.run.tar.gz_g
cuda_11.1.0_455.23.05_linux.run.tar.gz_h
cuda_11.1.0_455.23.05_linux.run.tar.gz_i
cuda_11.1.0_455.23.05_linux.run.tar.gz_j
cuda_11.1.0_455.23.05_linux.run.tar.gz_k
cuda_11.1.0_455.23.05_linux.run.tar.gz_l
cuda_11.1.0_455.23.05_linux.run.tar.gz_m
合包
cat cuda_11.1.0_455.23.05_linux.run.tar.gz_* > cuda_11.1.0_455.23.05_linux.run.tar.gz
命令解压
tar zxvf cuda_11.1.0_455.23.05_linux.run.tar.gz
[root@cpanel ~]# ls
cuda_11.1.0_455.23.05_linux.run
cuda_11.1.0_455.23.05_linux.run.tar.gz
cuda_11.1.0_455.23.05_linux.run.tar.gz_a
cuda_11.1.0_455.23.05_linux.run.tar.gz_b
cuda_11.1.0_455.23.05_linux.run.tar.gz_c
cuda_11.1.0_455.23.05_linux.run.tar.gz_d
cuda_11.1.0_455.23.05_linux.run.tar.gz_e
cuda_11.1.0_455.23.05_linux.run.tar.gz_f
cuda_11.1.0_455.23.05_linux.run.tar.gz_g
cuda_11.1.0_455.23.05_linux.run.tar.gz_h
cuda_11.1.0_455.23.05_linux.run.tar.gz_i
cuda_11.1.0_455.23.05_linux.run.tar.gz_j
cuda_11.1.0_455.23.05_linux.run.tar.gz_k
cuda_11.1.0_455.23.05_linux.run.tar.gz_l
cuda_11.1.0_455.23.05_linux.run.tar.gz_m

安装 cuda 11.1.0
[root@cpanel ~]# sudo sh cuda_11.1.0_455.23.05_linux.run --librarypath=/usr/local/cuda-11.1.0

┌─                                                                    ─
│  End User License Agreement
│  --------------------------
│
│  NVIDIA Software License Agreement and CUDA Supplement to
│  Software License Agreement.
│
│
│  Preface
│  -------
│
│  The Software License Agreement in Chapter 1 and the Supplement
│  in Chapter 2 contain license terms and conditions that govern
│  the use of NVIDIA software. By accepting this agreement, you
│  agree to comply with all the terms and conditions applicable
│  to the product(s) included herein.
│
│
│  NVIDIA Driver
│
│
│─                                                                    ─
│ Do you accept the above EULA? (accept/decline/quit):
│accept
└─      
┌─eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee┐
│ CUDA Installer                                                               │
│ - [ ] Driver                                                                 │
│      [ ] 455.23.05                                                           │
│ + [X] CUDA Toolkit 11.1                                                      │
│   [ ] CUDA Samples 11.1                                                      │
│   [ ] CUDA Demo Suite 11.1                                                   │
│   [ ] CUDA Documentation 11.1                                                │
│   Options                                                                    │
│   Install                                                                    │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│ Up/Down: Move | Left/Right: Expand | 'Enter': Select | 'A': Advanced options │
===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-11.1/

Please make sure that
 -   PATH includes /usr/local/cuda-11.1/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-11.1/lib64, or, add /usr/local/cuda-11.1/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.1/bin
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least .00 is required for CUDA 11.1 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 --driver

Logfile is /var/log/cuda-installer.log
问题并没有解决
>>> import tensorflow as tf
2021-02-12 17:05:29.599548: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2021-02-12 17:05:29.599577: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
>>> exit();
查找libcudart.so.11.0
(base) [root@cpanel ~]# sudo find / -name 'libcudart.so.11.0'
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudart.so.11.0
(base) [root@cpanel ~]# vim .bash_profile
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.1/targets/x86_64-linux/lib

PATH=$PATH:$HOME/bin

export PATH
export LD_LIBRARY_PATH
(base) [root@cpanel ~]# source .bash_profile
到目前为止理论上是已经OK的如果不OK我们就安装minicoda
安装minicoda
https://docs.conda.io/en/latest/miniconda.html
下载 miniconda3
[root@cpanel ~]# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

安装

[root@cpanel ~]# sudo sh Miniconda3-latest-Linux-x86_64.sh

Welcome to Miniconda3 py38_4.9.2

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>> 
===================================
End User License Agreement - Anaconda Individual Edition
===================================

Copyright 2015-2020, Anaconda, Inc.

All rights reserved under the 3-clause BSD License:
.
.
.

Please answer 'yes' or 'no':'
>>> yes

Miniconda3 will now be installed into this location:
/root/miniconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/root/miniconda3] >>> /usr/local/miniconda3
PREFIX=/usr/local/miniconda3
Unpacking payload ...
Collecting package metadata (current_repodata.json): done                                  
Solving environment: done

## Package Plan ##

  environment location: /usr/local/miniconda3

  added / updated specs:
    - _libgcc_mutex==0.1=main
    - brotlipy==0.7.0=py38h27cfd23_1003
    - ca-certificates==2020.10.14=0
    - certifi==2020.6.20=pyhd3eb1b0_3
    - cffi==1.14.3=py38h261ae71_2
    - chardet==3.0.4=py38h06a4308_1003
    - conda-package-handling==1.7.2=py38h03888b9_0
    - conda==4.9.2=py38h06a4308_0
    - cryptography==3.2.1=py38h3c74f83_1
    - idna==2.10=py_0
    - ld_impl_linux-64==2.33.1=h53a641e_7
    - libedit==3.1.20191231=h14c3975_1
    - libffi==3.3=he6710b0_2
    - libgcc-ng==9.1.0=hdf63c60_0
    - libstdcxx-ng==9.1.0=hdf63c60_0
    - ncurses==6.2=he6710b0_1
    - openssl==1.1.1h=h7b6447c_0
    - pip==20.2.4=py38h06a4308_0
    - pycosat==0.6.3=py38h7b6447c_1
    - pycparser==2.20=py_2
    - pyopenssl==19.1.0=pyhd3eb1b0_1
    - pysocks==1.7.1=py38h06a4308_0
    - python==3.8.5=h7579374_1
    - readline==8.0=h7b6447c_0
    - requests==2.24.0=py_0
    - ruamel_yaml==0.15.87=py38h7b6447c_1
    - setuptools==50.3.1=py38h06a4308_1
    - six==1.15.0=py38h06a4308_0
    - sqlite==3.33.0=h62c20be_0
    - tk==8.6.10=hbc83047_0
    - tqdm==4.51.0=pyhd3eb1b0_0
    - urllib3==1.25.11=py_0
    - wheel==0.35.1=pyhd3eb1b0_0
    - xz==5.2.5=h7b6447c_0
    - yaml==0.2.5=h7b6447c_0
    - zlib==1.2.11=h7b6447c_3


The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main
  brotlipy           pkgs/main/linux-64::brotlipy-0.7.0-py38h27cfd23_1003
  ca-certificates    pkgs/main/linux-64::ca-certificates-2020.10.14-0
  certifi            pkgs/main/noarch::certifi-2020.6.20-pyhd3eb1b0_3
  cffi               pkgs/main/linux-64::cffi-1.14.3-py38h261ae71_2
  chardet            pkgs/main/linux-64::chardet-3.0.4-py38h06a4308_1003
  conda              pkgs/main/linux-64::conda-4.9.2-py38h06a4308_0
  conda-package-han~ pkgs/main/linux-64::conda-package-handling-1.7.2-py38h03888b9_0
  cryptography       pkgs/main/linux-64::cryptography-3.2.1-py38h3c74f83_1
  idna               pkgs/main/noarch::idna-2.10-py_0
  ld_impl_linux-64   pkgs/main/linux-64::ld_impl_linux-64-2.33.1-h53a641e_7
  libedit            pkgs/main/linux-64::libedit-3.1.20191231-h14c3975_1
  libffi             pkgs/main/linux-64::libffi-3.3-he6710b0_2
  libgcc-ng          pkgs/main/linux-64::libgcc-ng-9.1.0-hdf63c60_0
  libstdcxx-ng       pkgs/main/linux-64::libstdcxx-ng-9.1.0-hdf63c60_0
  ncurses            pkgs/main/linux-64::ncurses-6.2-he6710b0_1
  openssl            pkgs/main/linux-64::openssl-1.1.1h-h7b6447c_0
  pip                pkgs/main/linux-64::pip-20.2.4-py38h06a4308_0
  pycosat            pkgs/main/linux-64::pycosat-0.6.3-py38h7b6447c_1
  pycparser          pkgs/main/noarch::pycparser-2.20-py_2
  pyopenssl          pkgs/main/noarch::pyopenssl-19.1.0-pyhd3eb1b0_1
  pysocks            pkgs/main/linux-64::pysocks-1.7.1-py38h06a4308_0
  python             pkgs/main/linux-64::python-3.8.5-h7579374_1
  readline           pkgs/main/linux-64::readline-8.0-h7b6447c_0
  requests           pkgs/main/noarch::requests-2.24.0-py_0
  ruamel_yaml        pkgs/main/linux-64::ruamel_yaml-0.15.87-py38h7b6447c_1
  setuptools         pkgs/main/linux-64::setuptools-50.3.1-py38h06a4308_1
  six                pkgs/main/linux-64::six-1.15.0-py38h06a4308_0
  sqlite             pkgs/main/linux-64::sqlite-3.33.0-h62c20be_0
  tk                 pkgs/main/linux-64::tk-8.6.10-hbc83047_0
  tqdm               pkgs/main/noarch::tqdm-4.51.0-pyhd3eb1b0_0
  urllib3            pkgs/main/noarch::urllib3-1.25.11-py_0
  wheel              pkgs/main/noarch::wheel-0.35.1-pyhd3eb1b0_0
  xz                 pkgs/main/linux-64::xz-5.2.5-h7b6447c_0
  yaml               pkgs/main/linux-64::yaml-0.2.5-h7b6447c_0
  zlib               pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3


Preparing transaction: done
Executing transaction: done

installation finished.
Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
[no] >>> yes
no change     /usr/local/miniconda3/condabin/conda
no change     /usr/local/miniconda3/bin/conda
no change     /usr/local/miniconda3/bin/conda-env
no change     /usr/local/miniconda3/bin/activate
no change     /usr/local/miniconda3/bin/deactivate
no change     /usr/local/miniconda3/etc/profile.d/conda.sh
no change     /usr/local/miniconda3/etc/fish/conf.d/conda.fish
no change     /usr/local/miniconda3/shell/condabin/Conda.psm1
no change     /usr/local/miniconda3/shell/condabin/conda-hook.ps1
no change     /usr/local/miniconda3/lib/python3.8/site-packages/xontrib/conda.xsh
no change     /usr/local/miniconda3/etc/profile.d/conda.csh
modified      /root/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

If you'd prefer that conda's base environment not be activated on startup, 
   set the auto_activate_base parameter to false: 

conda config --set auto_activate_base false

Thank you for installing Miniconda3!
[root@cpanel ~]# source .bash_profile
(base) [root@cpanel ~]# conda -V
conda 4.9.2
通过conda安装cudatoolkit
(base) [root@cpanel ~]# conda install cudatoolkit
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /usr/local/miniconda3

  added / updated specs:
    - cudatoolkit


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2021.1.19  |       h06a4308_0         121 KB
    certifi-2020.12.5          |   py38h06a4308_0         141 KB
    cudatoolkit-11.0.221       |       h6bb024c_0       622.9 MB
    openssl-1.1.1i             |       h27cfd23_0         2.5 MB
    ------------------------------------------------------------
                                           Total:       625.7 MB

The following NEW packages will be INSTALLED:

  cudatoolkit        pkgs/main/linux-64::cudatoolkit-11.0.221-h6bb024c_0

The following packages will be UPDATED:

  ca-certificates                              2020.10.14-0 --> 2021.1.19-h06a4308_0
  certifi            pkgs/main/noarch::certifi-2020.6.20-p~ --> pkgs/main/linux-64::certifi-2020.12.5-py38h06a4308_0
  openssl                                 1.1.1h-h7b6447c_0 --> 1.1.1i-h27cfd23_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
openssl-1.1.1i       | 2.5 MB    | ################################################################## | 100% 
ca-certificates-2021 | 121 KB    | ################################################################## | 100% 
cudatoolkit-11.0.221 | 622.9 MB  | ########################################2                          |  61% 
cudatoolkit-11.0.221 | 622.9 MB  | ################################################################## | 100% 
certifi-2020.12.5    | 141 KB    | ################################################################## | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: | By downloading and using the CUDA Toolkit conda packages, you accept the terms and conditions of the CUDA End User License Agreement (EULA): https://docs.nvidia.com/cuda/eula/index.html

done
查找 libcudart.so.11.0
(base) [root@cpanel ~]# sudo find / -name 'libcudart.so.11.0'
/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudart.so.11.0
/usr/local/miniconda3/pkgs/cudatoolkit-11.0.221-h6bb024c_0/lib/libcudart.so.11.0
/usr/local/miniconda3/lib/libcudart.so.11.0

/usr/local/miniconda3/pkgs/cudatoolkit-11.0.221-h6bb024c_0/lib/libcudart.so.11.0 将被tensorflow加载。
我们把之前在/root/.bash_profile设置的LD_LIBRARY_PATH注释掉,因为.bashrc已经有了miniconda3的path。

#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.1/targets/x86_64-linux/lib
#PATH=$PATH:$HOME/bin
PATH=$PATH:$HOME/bin
export PATH
#export LD_LIBRARY_PATH
(base) [root@cpanel ~]# python
Python 3.8.5 (default, Sep  4 2020, 07:30:14) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
  File "", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
>>> exit();

安装miniconda 之后系统默认的python的版本为3.8.5,我们之前安装的python版本为3.8.7,我们的Tensorflow是在此版本的pip下安装的所以,3.8.5我们需要重新安装Tensorflow

重新安装TensorFlow
(base) [root@cpanel ~]# pip install --upgrade pip
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting pip
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 21.7 MB/s 
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.2.4
    Uninstalling pip-20.2.4:
      Successfully uninstalled pip-20.2.4
Successfully installed pip-21.0.1
(base) [root@cpanel ~]# pip -V
pip 21.0.1 from /usr/local/miniconda3/lib/python3.8/site-packages/pip (python 3.8)
(base) [root@cpanel ~]# pip install tensorflow
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting tensorflow
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/ac/9b/3fdbce9195fe53adbab1a930ee95a957af18c34a83ae5b1145f3cf8da409/tensorflow-2.4.1-cp38-cp38-manylinux2010_x86_64.whl (394.4 MB)
     |████████████████████████████████| 394.4 MB 247 kB/s 
Collecting wrapt~=1.12.1
  Using cached wrapt-1.12.1-cp38-cp38-linux_x86_64.whl
Collecting tensorflow-estimator<2.5.0,>=2.4.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/74/7e/622d9849abf3afb81e482ffc170758742e392ee129ce1540611199a59237/tensorflow_estimator-2.4.0-py2.py3-none-any.whl (462 kB)
     |████████████████████████████████| 462 kB 36.3 MB/s 
Collecting typing-extensions~=3.7.4
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/60/7a/e881b5abb54db0e6e671ab088d079c57ce54e8a01a3ca443f561ccadb37e/typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Collecting grpcio~=1.32.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/47/e2/a8516f907bcb7e641f05528b3e661dbb7149ac68478e992eb86afd3cdeeb/grpcio-1.32.0-cp38-cp38-manylinux2014_x86_64.whl (3.8 MB)
     |████████████████████████████████| 3.8 MB 3.0 MB/s 
Collecting protobuf>=3.9.2
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/3e/b2/e4099c78e483e7a612d67eeb0c8740ce15cdeba4a0032da121c791f7d352/protobuf-3.14.0-cp38-cp38-manylinux1_x86_64.whl (1.0 MB)
     |████████████████████████████████| 1.0 MB 7.5 MB/s 
Requirement already satisfied: six~=1.15.0 in /usr/local/miniconda3/lib/python3.8/site-packages (from tensorflow) (1.15.0)
Collecting keras-preprocessing~=1.1.2
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/79/4c/7c3275a01e12ef9368a892926ab932b33bb13d55794881e3573482b378a7/Keras_Preprocessing-1.1.2-py2.py3-none-any.whl (42 kB)
     |████████████████████████████████| 42 kB 48.9 MB/s 
Collecting h5py~=2.10.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/9d/4f/46dbeea4aee767e15725950b6aac2c56c4eff9e5044886aa7ef932319476/h5py-2.10.0-cp38-cp38-manylinux1_x86_64.whl (2.9 MB)
     |████████████████████████████████| 2.9 MB 3.6 MB/s 
Collecting numpy~=1.19.2
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/66/d7/3b133b17e185f14137bc8afe7a41daf1f31556900f10238312a5ae9c7345/numpy-1.19.5-cp38-cp38-manylinux2010_x86_64.whl (14.9 MB)
     |████████████████████████████████| 14.9 MB 2.1 MB/s 
Collecting tensorboard~=2.4
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/64/21/eebd23060763fedeefb78bc2b286e00fa1d8abda6f70efa2ee08c28af0d4/tensorboard-2.4.1-py3-none-any.whl (10.6 MB)
     |████████████████████████████████| 10.6 MB 1.2 MB/s 
Collecting absl-py~=0.10
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/bc/58/0aa6fb779dc69cfc811df3398fcbeaeefbf18561b6e36b185df0782781cc/absl_py-0.11.0-py3-none-any.whl (127 kB)
     |████████████████████████████████| 127 kB 155.5 MB/s 
Collecting flatbuffers~=1.12.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/eb/26/712e578c5f14e26ae3314c39a1bdc4eb2ec2f4ddc89b708cf8e0a0d20423/flatbuffers-1.12-py2.py3-none-any.whl (15 kB)
Collecting termcolor~=1.1.0
  Using cached termcolor-1.1.0-py3-none-any.whl
Requirement already satisfied: wheel~=0.35 in /usr/local/miniconda3/lib/python3.8/site-packages (from tensorflow) (0.35.1)
Collecting opt-einsum~=3.3.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/bc/19/404708a7e54ad2798907210462fd950c3442ea51acc8790f3da48d2bee8b/opt_einsum-3.3.0-py3-none-any.whl (65 kB)
     |████████████████████████████████| 65 kB 107.2 MB/s 
Collecting gast==0.3.3
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/d6/84/759f5dd23fec8ba71952d97bcc7e2c9d7d63bdc582421f3cd4be845f0c98/gast-0.3.3-py2.py3-none-any.whl (9.7 kB)
Collecting google-pasta~=0.2
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/a3/de/c648ef6835192e6e2cc03f40b19eeda4382c49b5bafb43d88b931c4c74ac/google_pasta-0.2.0-py3-none-any.whl (57 kB)
     |████████████████████████████████| 57 kB 105.4 MB/s 
Collecting astunparse~=1.6.3
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/2b/03/13dde6512ad7b4557eb792fbcf0c653af6076b81e5941d36ec61f7ce6028/astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Collecting google-auth<2,>=1.6.3
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/f7/78/d15c9579274d5d06f11e351edfdac36c4e09d42550f5de083b4b77155421/google_auth-1.26.1-py2.py3-none-any.whl (116 kB)
     |████████████████████████████████| 116 kB 12.5 MB/s 
Collecting markdown>=2.6.8
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/ac/ef/24a91ca96efa0d7802dffb83ccc7a3c677027bea19ec3c9ee80be740408e/Markdown-3.3.3-py3-none-any.whl (96 kB)
     |████████████████████████████████| 96 kB 111.7 MB/s 
Collecting tensorboard-plugin-wit>=1.6.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/1a/c1/499e600ba0c618b451cd9c425ae1c177249940a2086316552fee7d86c954/tensorboard_plugin_wit-1.8.0-py3-none-any.whl (781 kB)
     |████████████████████████████████| 781 kB 30.4 MB/s 
Collecting werkzeug>=0.11.15
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/cc/94/5f7079a0e00bd6863ef8f1da638721e9da21e5bacee597595b318f71d62e/Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
     |████████████████████████████████| 298 kB 151.9 MB/s 
Collecting google-auth-oauthlib<0.5,>=0.4.1
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/81/67/e2c34bb0628984c7ce71cce6ba6964cb29c418873847fc285f826e032e6e/google_auth_oauthlib-0.4.2-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: setuptools>=41.0.0 in /usr/local/miniconda3/lib/python3.8/site-packages (from tensorboard~=2.4->tensorflow) (50.3.1.post20201107)
Requirement already satisfied: requests<3,>=2.21.0 in /usr/local/miniconda3/lib/python3.8/site-packages (from tensorboard~=2.4->tensorflow) (2.24.0)
Collecting rsa<5,>=3.1.4
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/bf/87/dc7a6ebf0afbc602548627fa48e9c1147fa187233bf71d4c51c76a2cfb27/rsa-4.7-py3-none-any.whl (34 kB)
Collecting pyasn1-modules>=0.2.1
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/95/de/214830a981892a3e286c3794f41ae67a4495df1108c3da8a9f62159b9a9d/pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
     |████████████████████████████████| 155 kB 146.9 MB/s 
Collecting cachetools<5.0,>=2.0.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/bb/72/8df2e0dc991f1a1d2c6869404e7622e8ee50d80bff357dbb57c3df70305b/cachetools-4.2.1-py3-none-any.whl (12 kB)
Collecting requests-oauthlib>=0.7.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/a3/12/b92740d845ab62ea4edf04d2f4164d82532b5a0b03836d4d4e71c6f3d379/requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB)
Collecting pyasn1<0.5.0,>=0.4.6
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/62/1e/a94a8d635fa3ce4cfc7f506003548d0a2447ae76fd5ca53932970fe3053f/pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
     |████████████████████████████████| 77 kB 116.0 MB/s 
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/miniconda3/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard~=2.4->tensorflow) (2020.12.5)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/miniconda3/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard~=2.4->tensorflow) (2.10)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/miniconda3/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard~=2.4->tensorflow) (1.25.11)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/miniconda3/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard~=2.4->tensorflow) (3.0.4)
Collecting oauthlib>=3.0.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/05/57/ce2e7a8fa7c0afb54a0581b14a65b56e62b5759dbc98e80627142b8a3704/oauthlib-3.1.0-py2.py3-none-any.whl (147 kB)
     |████████████████████████████████| 147 kB 148.0 MB/s 
Installing collected packages: pyasn1, rsa, pyasn1-modules, oauthlib, cachetools, requests-oauthlib, google-auth, werkzeug, tensorboard-plugin-wit, protobuf, numpy, markdown, grpcio, google-auth-oauthlib, absl-py, wrapt, typing-extensions, termcolor, tensorflow-estimator, tensorboard, opt-einsum, keras-preprocessing, h5py, google-pasta, gast, flatbuffers, astunparse, tensorflow
Successfully installed absl-py-0.11.0 astunparse-1.6.3 cachetools-4.2.1 flatbuffers-1.12 gast-0.3.3 google-auth-1.26.1 google-auth-oauthlib-0.4.2 google-pasta-0.2.0 grpcio-1.32.0 h5py-2.10.0 keras-preprocessing-1.1.2 markdown-3.3.3 numpy-1.19.5 oauthlib-3.1.0 opt-einsum-3.3.0 protobuf-3.14.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-oauthlib-1.3.0 rsa-4.7 tensorboard-2.4.1 tensorboard-plugin-wit-1.8.0 tensorflow-2.4.1 tensorflow-estimator-2.4.0 termcolor-1.1.0 typing-extensions-3.7.4.3 werkzeug-1.0.1 wrapt-1.12.1
测试1
(base) [root@cpanel ~]# python
Python 3.8.5 (default, Sep  4 2020, 07:30:14) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf;
2021-02-12 18:01:41.370027: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
>>> 

Successfully opened dynamic library libcudart.so.11.0

测试2
>>> import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))
2021-02-12 18:12:28.192098: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-02-12 18:12:28.192371: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2021-02-12 18:12:28.192388: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
2021-02-12 18:12:28.192405: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (cpanel.xn--8zr900a.cn): /proc/driver/nvidia/version does not exist
2021-02-12 18:12:28.192729: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-02-12 18:12:28.192826: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
tf.Tensor(-80.21045, shape=(), dtype=float32)
# sudo find / -name 'libcuda.so.1'

没有找到libcuda.so.1

解决 ‘libcuda.so.1’ 缺失的问题

下载

wget https://mirror.rackspace.com/elrepo/elrepo/el8/x86_64/RPMS/nvidia-x11-drv-libs-460.39-1.el8_3.elrepo.x86_64.rpm

不同的系统下载不同的安装包这里的安装包只适合Centos 8

(base) [root@cpanel ~]# dnf install nvidia-x11-drv-libs-460.39-1.el8_3.elrepo.x86_64.rpm

================================================================================
 软件包                 架构   版本                          仓库          大小
================================================================================
安装:
 nvidia-x11-drv-libs    x86_64 460.39-1.el8_3.elrepo         @commandline 110 M
安装依赖关系:
 adwaita-cursor-theme   noarch 3.28.0-2.el8                  appstream    647 k
 adwaita-icon-theme     noarch 3.28.0-2.el8                  appstream     11 M
 at-spi2-atk            x86_64 2.26.2-1.el8                  appstream     89 k
 at-spi2-core           x86_64 2.28.0-1.el8                  appstream    169 k
 atk                    x86_64 2.28.1-1.el8                  appstream    272 k
 colord-libs            x86_64 1.4.2-1.el8                   appstream    236 k
 egl-wayland            x86_64 1.1.4-1.el8                   appstream     33 k
 fribidi                x86_64 1.0.4-8.el8                   appstream     89 k
 gdk-pixbuf2-modules    x86_64 2.36.12-5.el8                 appstream    109 k
 graphite2              x86_64 1.3.10-10.el8                 appstream    122 k
 gtk-update-icon-cache  x86_64 3.22.30-6.el8                 appstream     32 k
 gtk3                   x86_64 3.22.30-6.el8                 appstream    4.5 M
 harfbuzz               x86_64 1.7.5-3.el8                   appstream    295 k
 hicolor-icon-theme     noarch 0.17-2.el8                    appstream     49 k
 jasper-libs            x86_64 2.0.14-4.el8                  appstream    167 k
 jbigkit-libs           x86_64 2.1-14.el8                    appstream     55 k
 lcms2                  x86_64 2.9-2.el8                     appstream    165 k
 libX11-xcb             x86_64 1.6.8-3.el8                   appstream     14 k
 libXcomposite          x86_64 0.4.4-14.el8                  appstream     28 k
 libXcursor             x86_64 1.1.15-3.el8                  appstream     36 k
 libXdamage             x86_64 1.1.4-14.el8                  appstream     27 k
 libXdmcp               x86_64 1.1.3-1.el8                   appstream     41 k
 libXfixes              x86_64 5.0.3-7.el8                   appstream     25 k
 libXfont2              x86_64 2.0.3-2.el8                   appstream    149 k
 libXft                 x86_64 2.3.3-1.el8                   appstream     67 k
 libXi                  x86_64 1.7.10-1.el8                  appstream     49 k
 libXinerama            x86_64 1.1.4-1.el8                   appstream     16 k
 libXrandr              x86_64 1.5.2-1.el8                   appstream     34 k
 libXtst                x86_64 1.2.3-7.el8                   appstream     22 k
 libXxf86vm             x86_64 1.1.4-9.el8                   appstream     19 k
 libdatrie              x86_64 0.2.9-7.el8                   appstream     33 k
 libdrm                 x86_64 2.4.101-1.el8                 appstream    165 k
 libepoxy               x86_64 1.5.3-1.el8                   appstream    225 k
 libevdev               x86_64 1.8.0-1.el8                   appstream     43 k
 libfontenc             x86_64 1.1.3-8.el8                   appstream     37 k
 libglvnd               x86_64 1:1.2.0-6.el8                 appstream     98 k
 libglvnd-egl           x86_64 1:1.2.0-6.el8                 appstream     50 k
 libglvnd-gles          x86_64 1:1.2.0-6.el8                 appstream     40 k
 libglvnd-glx           x86_64 1:1.2.0-6.el8                 appstream    136 k
 libglvnd-opengl        x86_64 1:1.2.0-6.el8                 appstream     48 k
 libinput               x86_64 1.14.3-1.el8                  appstream    206 k
 libjpeg-turbo          x86_64 1.5.3-10.el8                  appstream    156 k
 libpciaccess           x86_64 0.14-1.el8                    baseos        32 k
 libthai                x86_64 0.1.27-2.el8                  appstream    203 k
 libtiff                x86_64 4.0.9-18.el8                  appstream    188 k
 libvdpau               x86_64 1.4-2.el8                     appstream     41 k
 libwacom               x86_64 1.1-3.el8                     appstream     41 k
 libwacom-data          noarch 1.1-3.el8                     appstream     91 k
 libwayland-client      x86_64 1.17.0-1.el8                  appstream     39 k
 libwayland-cursor      x86_64 1.17.0-1.el8                  appstream     26 k
 libwayland-egl         x86_64 1.17.0-1.el8                  appstream     19 k
 libwayland-server      x86_64 1.17.0-1.el8                  appstream     45 k
 libxkbfile             x86_64 1.1.0-1.el8                   appstream     88 k
 libxshmfence           x86_64 1.3-2.el8                     appstream     13 k
 llvm-libs              x86_64 10.0.1-3.module_el8.3.0+467+cb298d5b
                                                             appstream     20 M
 mesa-libEGL            x86_64 20.1.4-1.el8                  appstream    138 k
 mesa-libGL             x86_64 20.1.4-1.el8                  appstream    189 k
 mesa-libgbm            x86_64 20.1.4-1.el8                  appstream     60 k
 mesa-libglapi          x86_64 20.1.4-1.el8                  appstream     64 k
 mesa-vulkan-drivers    x86_64 20.1.4-1.el8                  appstream    4.2 M
 mtdev                  x86_64 1.1.5-12.el8                  appstream     24 k
 ocl-icd                x86_64 2.2.12-1.el8                  appstream     51 k
 opencl-filesystem      noarch 1.0-6.el8                     appstream    8.4 k
 pango                  x86_64 1.42.4-6.el8                  appstream    298 k
 rest                   x86_64 0.8.1-2.el8                   appstream     70 k
 vulkan-loader          x86_64 1.2.148.0-1.el8               appstream    118 k
 xorg-x11-drv-fbdev     x86_64 0.5.0-2.el8                   appstream     27 k
 xorg-x11-drv-libinput  x86_64 0.29.0-1.el8                  appstream     50 k
 xorg-x11-drv-vesa      x86_64 2.4.0-3.el8                   appstream     31 k
 xorg-x11-server-Xorg   x86_64 1.20.8-6.1.el8_3              appstream    1.5 M
 xorg-x11-server-common x86_64 1.20.8-6.1.el8_3              appstream     42 k
 xorg-x11-xkb-utils     x86_64 7.7-28.el8                    appstream    114 k
安装弱的依赖:
 dconf                  x86_64 0.28.0-3.el8                  appstream    109 k
启用模块流:
 llvm-toolset                  rhel8                                           

事务概要
================================================================================
安装  74 软件包

总计:158 M
总下载:48 M
安装大小:508 M
确定吗?[y/N]: y
下载软件包:
(1/73): at-spi2-atk-2.26.2-1.el8.x86_64.rpm     247 kB/s |  89 kB     00:00    
(2/73): at-spi2-core-2.28.0-1.el8.x86_64.rpm    1.2 MB/s | 169 kB     00:00    
(3/73): adwaita-cursor-theme-3.28.0-2.el8.noarc 1.2 MB/s | 647 kB     00:00    
(4/73): atk-2.28.1-1.el8.x86_64.rpm             1.4 MB/s | 272 kB     00:00    
(5/73): dconf-0.28.0-3.el8.x86_64.rpm           1.1 MB/s | 109 kB     00:00    
(6/73): egl-wayland-1.1.4-1.el8.x86_64.rpm      396 kB/s |  33 kB     00:00    
(7/73): fribidi-1.0.4-8.el8.x86_64.rpm          1.2 MB/s |  89 kB     00:00    
(8/73): gdk-pixbuf2-modules-2.36.12-5.el8.x86_6 1.4 MB/s | 109 kB     00:00    
(9/73): graphite2-1.3.10-10.el8.x86_64.rpm      1.5 MB/s | 122 kB     00:00    
(10/73): gtk-update-icon-cache-3.22.30-6.el8.x8 475 kB/s |  32 kB     00:00    
(11/73): colord-libs-1.4.2-1.el8.x86_64.rpm     263 kB/s | 236 kB     00:00    
(12/73): adwaita-icon-theme-3.28.0-2.el8.noarch 6.7 MB/s |  11 MB     00:01    
(13/73): harfbuzz-1.7.5-3.el8.x86_64.rpm        1.0 MB/s | 295 kB     00:00    
(14/73): hicolor-icon-theme-0.17-2.el8.noarch.r 755 kB/s |  49 kB     00:00    
(15/73): jasper-libs-2.0.14-4.el8.x86_64.rpm    2.1 MB/s | 167 kB     00:00    
(16/73): jbigkit-libs-2.1-14.el8.x86_64.rpm     852 kB/s |  55 kB     00:00    
(17/73): lcms2-2.9-2.el8.x86_64.rpm             2.1 MB/s | 165 kB     00:00    
(18/73): libX11-xcb-1.6.8-3.el8.x86_64.rpm      227 kB/s |  14 kB     00:00    
(19/73): libXcomposite-0.4.4-14.el8.x86_64.rpm  412 kB/s |  28 kB     00:00    
(20/73): libXcursor-1.1.15-3.el8.x86_64.rpm     568 kB/s |  36 kB     00:00    
(21/73): libXdamage-1.1.4-14.el8.x86_64.rpm     387 kB/s |  27 kB     00:00    
(22/73): libXdmcp-1.1.3-1.el8.x86_64.rpm        631 kB/s |  41 kB     00:00    
(23/73): libXfixes-5.0.3-7.el8.x86_64.rpm       362 kB/s |  25 kB     00:00    
(24/73): libXfont2-2.0.3-2.el8.x86_64.rpm       1.5 MB/s | 149 kB     00:00    
(25/73): libXft-2.3.3-1.el8.x86_64.rpm          929 kB/s |  67 kB     00:00    
(26/73): libXi-1.7.10-1.el8.x86_64.rpm          760 kB/s |  49 kB     00:00    
(27/73): libXinerama-1.1.4-1.el8.x86_64.rpm     230 kB/s |  16 kB     00:00    
(28/73): libXrandr-1.5.2-1.el8.x86_64.rpm       535 kB/s |  34 kB     00:00    
(29/73): libXtst-1.2.3-7.el8.x86_64.rpm         319 kB/s |  22 kB     00:00    
(30/73): libXxf86vm-1.1.4-9.el8.x86_64.rpm      310 kB/s |  19 kB     00:00    
(31/73): libdatrie-0.2.9-7.el8.x86_64.rpm       479 kB/s |  33 kB     00:00    
(32/73): libdrm-2.4.101-1.el8.x86_64.rpm        2.2 MB/s | 165 kB     00:00    
(33/73): libevdev-1.8.0-1.el8.x86_64.rpm        682 kB/s |  43 kB     00:00    
(34/73): gtk3-3.22.30-6.el8.x86_64.rpm          3.2 MB/s | 4.5 MB     00:01    
(35/73): libfontenc-1.1.3-8.el8.x86_64.rpm      412 kB/s |  37 kB     00:00    
(36/73): libglvnd-1.2.0-6.el8.x86_64.rpm        1.4 MB/s |  98 kB     00:00    
(37/73): libglvnd-egl-1.2.0-6.el8.x86_64.rpm    763 kB/s |  50 kB     00:00    
(38/73): libglvnd-gles-1.2.0-6.el8.x86_64.rpm   630 kB/s |  40 kB     00:00    
(39/73): libglvnd-glx-1.2.0-6.el8.x86_64.rpm    1.9 MB/s | 136 kB     00:00    
(40/73): libglvnd-opengl-1.2.0-6.el8.x86_64.rpm 529 kB/s |  48 kB     00:00    
(41/73): libjpeg-turbo-1.5.3-10.el8.x86_64.rpm  2.2 MB/s | 156 kB     00:00    
(42/73): libinput-1.14.3-1.el8.x86_64.rpm       1.2 MB/s | 206 kB     00:00    
(43/73): libthai-0.1.27-2.el8.x86_64.rpm        2.2 MB/s | 203 kB     00:00    
(44/73): libepoxy-1.5.3-1.el8.x86_64.rpm        388 kB/s | 225 kB     00:00    
(45/73): libtiff-4.0.9-18.el8.x86_64.rpm        1.4 MB/s | 188 kB     00:00    
(46/73): libvdpau-1.4-2.el8.x86_64.rpm          514 kB/s |  41 kB     00:00    
(47/73): libwacom-data-1.1-3.el8.noarch.rpm     1.2 MB/s |  91 kB     00:00    
(48/73): libwayland-client-1.17.0-1.el8.x86_64. 615 kB/s |  39 kB     00:00    
(49/73): libwayland-cursor-1.17.0-1.el8.x86_64. 410 kB/s |  26 kB     00:00    
(50/73): libwayland-egl-1.17.0-1.el8.x86_64.rpm 312 kB/s |  19 kB     00:00    
(51/73): libwayland-server-1.17.0-1.el8.x86_64. 697 kB/s |  45 kB     00:00    
(52/73): libxkbfile-1.1.0-1.el8.x86_64.rpm      1.3 MB/s |  88 kB     00:00    
(53/73): libwacom-1.1-3.el8.x86_64.rpm          148 kB/s |  41 kB     00:00    
(54/73): libxshmfence-1.3-2.el8.x86_64.rpm      122 kB/s |  13 kB     00:00    
(55/73): mesa-libEGL-20.1.4-1.el8.x86_64.rpm    517 kB/s | 138 kB     00:00    
(56/73): mesa-libGL-20.1.4-1.el8.x86_64.rpm     1.0 MB/s | 189 kB     00:00    
(57/73): mesa-libgbm-20.1.4-1.el8.x86_64.rpm    837 kB/s |  60 kB     00:00    
(58/73): mesa-libglapi-20.1.4-1.el8.x86_64.rpm  831 kB/s |  64 kB     00:00    
(59/73): mtdev-1.1.5-12.el8.x86_64.rpm          209 kB/s |  24 kB     00:00    
(60/73): ocl-icd-2.2.12-1.el8.x86_64.rpm        486 kB/s |  51 kB     00:00    
(61/73): opencl-filesystem-1.0-6.el8.noarch.rpm  93 kB/s | 8.4 kB     00:00    
(62/73): pango-1.42.4-6.el8.x86_64.rpm          1.5 MB/s | 298 kB     00:00    
(63/73): rest-0.8.1-2.el8.x86_64.rpm            1.0 MB/s |  70 kB     00:00    
(64/73): vulkan-loader-1.2.148.0-1.el8.x86_64.r 1.7 MB/s | 118 kB     00:00    
(65/73): xorg-x11-drv-fbdev-0.5.0-2.el8.x86_64. 287 kB/s |  27 kB     00:00    
(66/73): xorg-x11-drv-libinput-0.29.0-1.el8.x86 767 kB/s |  50 kB     00:00    
(67/73): xorg-x11-drv-vesa-2.4.0-3.el8.x86_64.r 394 kB/s |  31 kB     00:00    
(68/73): mesa-vulkan-drivers-20.1.4-1.el8.x86_6 3.2 MB/s | 4.2 MB     00:01    
(69/73): xorg-x11-server-common-1.20.8-6.1.el8_ 474 kB/s |  42 kB     00:00    
(70/73): xorg-x11-xkb-utils-7.7-28.el8.x86_64.r 1.5 MB/s | 114 kB     00:00    
(71/73): xorg-x11-server-Xorg-1.20.8-6.1.el8_3. 1.8 MB/s | 1.5 MB     00:00    
(72/73): llvm-libs-10.0.1-3.module_el8.3.0+467+ 9.2 MB/s |  20 MB     00:02    
(73/73): libpciaccess-0.14-1.el8.x86_64.rpm      57 kB/s |  32 kB     00:00    
--------------------------------------------------------------------------------
总计                                            7.0 MB/s |  48 MB     00:06     
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                 1/1 
  安装    : libwayland-client-1.17.0-1.el8.x86_64                          1/74 
  安装    : libglvnd-1:1.2.0-6.el8.x86_64                                  2/74 
  安装    : libxshmfence-1.3-2.el8.x86_64                                  3/74 
  安装    : libXfixes-5.0.3-7.el8.x86_64                                   4/74 
  安装    : libwayland-server-1.17.0-1.el8.x86_64                          5/74 
  安装    : libjpeg-turbo-1.5.3-10.el8.x86_64                              6/74 
  安装    : libX11-xcb-1.6.8-3.el8.x86_64                                  7/74 
  安装    : atk-2.28.1-1.el8.x86_64                                        8/74 
  安装    : libXdamage-1.1.4-14.el8.x86_64                                 9/74 
  安装    : libpciaccess-0.14-1.el8.x86_64                                10/74 
  安装    : libdrm-2.4.101-1.el8.x86_64                                   11/74 
  安装    : mesa-libgbm-20.1.4-1.el8.x86_64                               12/74 
  运行脚本: mesa-libgbm-20.1.4-1.el8.x86_64                               12/74 
  安装    : mesa-libglapi-20.1.4-1.el8.x86_64                             13/74 
  运行脚本: mesa-libglapi-20.1.4-1.el8.x86_64                             13/74 
  安装    : libglvnd-egl-1:1.2.0-6.el8.x86_64                             14/74 
  安装    : mesa-libEGL-20.1.4-1.el8.x86_64                               15/74 
  安装    : libepoxy-1.5.3-1.el8.x86_64                                   16/74 
  安装    : libXi-1.7.10-1.el8.x86_64                                     17/74 
  安装    : libXtst-1.2.3-7.el8.x86_64                                    18/74 
  安装    : at-spi2-core-2.28.0-1.el8.x86_64                              19/74 
  运行脚本: at-spi2-core-2.28.0-1.el8.x86_64                              19/74 
  安装    : at-spi2-atk-2.26.2-1.el8.x86_64                               20/74 
  运行脚本: at-spi2-atk-2.26.2-1.el8.x86_64                               20/74 
  安装    : libglvnd-gles-1:1.2.0-6.el8.x86_64                            21/74 
  安装    : egl-wayland-1.1.4-1.el8.x86_64                                22/74 
  安装    : jasper-libs-2.0.14-4.el8.x86_64                               23/74 
  安装    : libXcursor-1.1.15-3.el8.x86_64                                24/74 
  安装    : libglvnd-opengl-1:1.2.0-6.el8.x86_64                          25/74 
  安装    : libwayland-cursor-1.17.0-1.el8.x86_64                         26/74 
  安装    : rest-0.8.1-2.el8.x86_64                                       27/74 
  运行脚本: rest-0.8.1-2.el8.x86_64                                       27/74 
  安装    : opencl-filesystem-1.0-6.el8.noarch                            28/74 
  安装    : ocl-icd-2.2.12-1.el8.x86_64                                   29/74 
  运行脚本: ocl-icd-2.2.12-1.el8.x86_64                                   29/74 
  安装    : mtdev-1.1.5-12.el8.x86_64                                     30/74 
  运行脚本: mtdev-1.1.5-12.el8.x86_64                                     30/74 
  安装    : llvm-libs-10.0.1-3.module_el8.3.0+467+cb298d5b.x86_64         31/74 
  安装    : vulkan-loader-1.2.148.0-1.el8.x86_64                          32/74 
  安装    : mesa-vulkan-drivers-20.1.4-1.el8.x86_64                       33/74 
  安装    : libxkbfile-1.1.0-1.el8.x86_64                                 34/74 
  安装    : xorg-x11-xkb-utils-7.7-28.el8.x86_64                          35/74 
  安装    : xorg-x11-server-common-1.20.8-6.1.el8_3.x86_64                36/74 
  安装    : libwayland-egl-1.17.0-1.el8.x86_64                            37/74 
  安装    : libwacom-data-1.1-3.el8.noarch                                38/74 
  安装    : libwacom-1.1-3.el8.x86_64                                     39/74 
  安装    : libvdpau-1.4-2.el8.x86_64                                     40/74 
  安装    : libfontenc-1.1.3-8.el8.x86_64                                 41/74 
  安装    : libXfont2-2.0.3-2.el8.x86_64                                  42/74 
  安装    : libevdev-1.8.0-1.el8.x86_64                                   43/74 
  安装    : libinput-1.14.3-1.el8.x86_64                                  44/74 
  运行脚本: libinput-1.14.3-1.el8.x86_64                                  44/74 
  安装    : libdatrie-0.2.9-7.el8.x86_64                                  45/74 
  运行脚本: libdatrie-0.2.9-7.el8.x86_64                                  45/74 
  安装    : libthai-0.1.27-2.el8.x86_64                                   46/74 
  运行脚本: libthai-0.1.27-2.el8.x86_64                                   46/74 
  安装    : libXxf86vm-1.1.4-9.el8.x86_64                                 47/74 
  安装    : libglvnd-glx-1:1.2.0-6.el8.x86_64                             48/74 
  安装    : mesa-libGL-20.1.4-1.el8.x86_64                                49/74 
  安装    : libXrandr-1.5.2-1.el8.x86_64                                  50/74 
  安装    : libXinerama-1.1.4-1.el8.x86_64                                51/74 
  安装    : libXft-2.3.3-1.el8.x86_64                                     52/74 
  安装    : libXdmcp-1.1.3-1.el8.x86_64                                   53/74 
  安装    : xorg-x11-drv-fbdev-0.5.0-2.el8.x86_64                         54/74 
  安装    : xorg-x11-drv-libinput-0.29.0-1.el8.x86_64                     55/74 
  安装    : xorg-x11-drv-vesa-2.4.0-3.el8.x86_64                          56/74 
  安装    : xorg-x11-server-Xorg-1.20.8-6.1.el8_3.x86_64                  57/74 
  安装    : libXcomposite-0.4.4-14.el8.x86_64                             58/74 
  安装    : lcms2-2.9-2.el8.x86_64                                        59/74 
  运行脚本: lcms2-2.9-2.el8.x86_64                                        59/74 
  安装    : colord-libs-1.4.2-1.el8.x86_64                                60/74 
  安装    : jbigkit-libs-2.1-14.el8.x86_64                                61/74 
  运行脚本: jbigkit-libs-2.1-14.el8.x86_64                                61/74 
  安装    : libtiff-4.0.9-18.el8.x86_64                                   62/74 
  安装    : gdk-pixbuf2-modules-2.36.12-5.el8.x86_64                      63/74 
  安装    : hicolor-icon-theme-0.17-2.el8.noarch                          64/74 
  安装    : gtk-update-icon-cache-3.22.30-6.el8.x86_64                    65/74 
  安装    : graphite2-1.3.10-10.el8.x86_64                                66/74 
  安装    : harfbuzz-1.7.5-3.el8.x86_64                                   67/74 
  运行脚本: harfbuzz-1.7.5-3.el8.x86_64                                   67/74 
  安装    : fribidi-1.0.4-8.el8.x86_64                                    68/74 
  安装    : pango-1.42.4-6.el8.x86_64                                     69/74 
  运行脚本: pango-1.42.4-6.el8.x86_64                                     69/74 
  安装    : dconf-0.28.0-3.el8.x86_64                                     70/74 
  安装    : adwaita-cursor-theme-3.28.0-2.el8.noarch                      71/74 
  安装    : adwaita-icon-theme-3.28.0-2.el8.noarch                        72/74 
  安装    : gtk3-3.22.30-6.el8.x86_64                                     73/74 
  安装    : nvidia-x11-drv-libs-460.39-1.el8_3.elrepo.x86_64              74/74 
  运行脚本: nvidia-x11-drv-libs-460.39-1.el8_3.elrepo.x86_64              74/74 
  运行脚本: dconf-0.28.0-3.el8.x86_64                                     74/74 
  运行脚本: nvidia-x11-drv-libs-460.39-1.el8_3.elrepo.x86_64              74/74 
  运行脚本: hicolor-icon-theme-0.17-2.el8.noarch                          74/74 
  运行脚本: adwaita-icon-theme-3.28.0-2.el8.noarch                        74/74 
  验证    : adwaita-cursor-theme-3.28.0-2.el8.noarch                       1/74 
  验证    : adwaita-icon-theme-3.28.0-2.el8.noarch                         2/74 
  验证    : at-spi2-atk-2.26.2-1.el8.x86_64                                3/74 
  验证    : at-spi2-core-2.28.0-1.el8.x86_64                               4/74 
  验证    : atk-2.28.1-1.el8.x86_64                                        5/74 
  验证    : colord-libs-1.4.2-1.el8.x86_64                                 6/74 
  验证    : dconf-0.28.0-3.el8.x86_64                                      7/74 
  验证    : egl-wayland-1.1.4-1.el8.x86_64                                 8/74 
  验证    : fribidi-1.0.4-8.el8.x86_64                                     9/74 
  验证    : gdk-pixbuf2-modules-2.36.12-5.el8.x86_64                      10/74 
  验证    : graphite2-1.3.10-10.el8.x86_64                                11/74 
  验证    : gtk-update-icon-cache-3.22.30-6.el8.x86_64                    12/74 
  验证    : gtk3-3.22.30-6.el8.x86_64                                     13/74 
  验证    : harfbuzz-1.7.5-3.el8.x86_64                                   14/74 
  验证    : hicolor-icon-theme-0.17-2.el8.noarch                          15/74 
  验证    : jasper-libs-2.0.14-4.el8.x86_64                               16/74 
  验证    : jbigkit-libs-2.1-14.el8.x86_64                                17/74 
  验证    : lcms2-2.9-2.el8.x86_64                                        18/74 
  验证    : libX11-xcb-1.6.8-3.el8.x86_64                                 19/74 
  验证    : libXcomposite-0.4.4-14.el8.x86_64                             20/74 
  验证    : libXcursor-1.1.15-3.el8.x86_64                                21/74 
  验证    : libXdamage-1.1.4-14.el8.x86_64                                22/74 
  验证    : libXdmcp-1.1.3-1.el8.x86_64                                   23/74 
  验证    : libXfixes-5.0.3-7.el8.x86_64                                  24/74 
  验证    : libXfont2-2.0.3-2.el8.x86_64                                  25/74 
  验证    : libXft-2.3.3-1.el8.x86_64                                     26/74 
  验证    : libXi-1.7.10-1.el8.x86_64                                     27/74 
  验证    : libXinerama-1.1.4-1.el8.x86_64                                28/74 
  验证    : libXrandr-1.5.2-1.el8.x86_64                                  29/74 
  验证    : libXtst-1.2.3-7.el8.x86_64                                    30/74 
  验证    : libXxf86vm-1.1.4-9.el8.x86_64                                 31/74 
  验证    : libdatrie-0.2.9-7.el8.x86_64                                  32/74 
  验证    : libdrm-2.4.101-1.el8.x86_64                                   33/74 
  验证    : libepoxy-1.5.3-1.el8.x86_64                                   34/74 
  验证    : libevdev-1.8.0-1.el8.x86_64                                   35/74 
  验证    : libfontenc-1.1.3-8.el8.x86_64                                 36/74 
  验证    : libglvnd-1:1.2.0-6.el8.x86_64                                 37/74 
  验证    : libglvnd-egl-1:1.2.0-6.el8.x86_64                             38/74 
  验证    : libglvnd-gles-1:1.2.0-6.el8.x86_64                            39/74 
  验证    : libglvnd-glx-1:1.2.0-6.el8.x86_64                             40/74 
  验证    : libglvnd-opengl-1:1.2.0-6.el8.x86_64                          41/74 
  验证    : libinput-1.14.3-1.el8.x86_64                                  42/74 
  验证    : libjpeg-turbo-1.5.3-10.el8.x86_64                             43/74 
  验证    : libthai-0.1.27-2.el8.x86_64                                   44/74 
  验证    : libtiff-4.0.9-18.el8.x86_64                                   45/74 
  验证    : libvdpau-1.4-2.el8.x86_64                                     46/74 
  验证    : libwacom-1.1-3.el8.x86_64                                     47/74 
  验证    : libwacom-data-1.1-3.el8.noarch                                48/74 
  验证    : libwayland-client-1.17.0-1.el8.x86_64                         49/74 
  验证    : libwayland-cursor-1.17.0-1.el8.x86_64                         50/74 
  验证    : libwayland-egl-1.17.0-1.el8.x86_64                            51/74 
  验证    : libwayland-server-1.17.0-1.el8.x86_64                         52/74 
  验证    : libxkbfile-1.1.0-1.el8.x86_64                                 53/74 
  验证    : libxshmfence-1.3-2.el8.x86_64                                 54/74 
  验证    : llvm-libs-10.0.1-3.module_el8.3.0+467+cb298d5b.x86_64         55/74 
  验证    : mesa-libEGL-20.1.4-1.el8.x86_64                               56/74 
  验证    : mesa-libGL-20.1.4-1.el8.x86_64                                57/74 
  验证    : mesa-libgbm-20.1.4-1.el8.x86_64                               58/74 
  验证    : mesa-libglapi-20.1.4-1.el8.x86_64                             59/74 
  验证    : mesa-vulkan-drivers-20.1.4-1.el8.x86_64                       60/74 
  验证    : mtdev-1.1.5-12.el8.x86_64                                     61/74 
  验证    : ocl-icd-2.2.12-1.el8.x86_64                                   62/74 
  验证    : opencl-filesystem-1.0-6.el8.noarch                            63/74 
  验证    : pango-1.42.4-6.el8.x86_64                                     64/74 
  验证    : rest-0.8.1-2.el8.x86_64                                       65/74 
  验证    : vulkan-loader-1.2.148.0-1.el8.x86_64                          66/74 
  验证    : xorg-x11-drv-fbdev-0.5.0-2.el8.x86_64                         67/74 
  验证    : xorg-x11-drv-libinput-0.29.0-1.el8.x86_64                     68/74 
  验证    : xorg-x11-drv-vesa-2.4.0-3.el8.x86_64                          69/74 
  验证    : xorg-x11-server-Xorg-1.20.8-6.1.el8_3.x86_64                  70/74 
  验证    : xorg-x11-server-common-1.20.8-6.1.el8_3.x86_64                71/74 
  验证    : xorg-x11-xkb-utils-7.7-28.el8.x86_64                          72/74 
  验证    : libpciaccess-0.14-1.el8.x86_64                                73/74 
  验证    : nvidia-x11-drv-libs-460.39-1.el8_3.elrepo.x86_64              74/74 

已安装:
  adwaita-cursor-theme-3.28.0-2.el8.noarch                                      
  adwaita-icon-theme-3.28.0-2.el8.noarch                                        
  at-spi2-atk-2.26.2-1.el8.x86_64                                               
  at-spi2-core-2.28.0-1.el8.x86_64                                              
  atk-2.28.1-1.el8.x86_64                                                       
  colord-libs-1.4.2-1.el8.x86_64                                                
  dconf-0.28.0-3.el8.x86_64                                                     
  egl-wayland-1.1.4-1.el8.x86_64                                                
  fribidi-1.0.4-8.el8.x86_64                                                    
  gdk-pixbuf2-modules-2.36.12-5.el8.x86_64                                      
  graphite2-1.3.10-10.el8.x86_64                                                
  gtk-update-icon-cache-3.22.30-6.el8.x86_64                                    
  gtk3-3.22.30-6.el8.x86_64                                                     
  harfbuzz-1.7.5-3.el8.x86_64                                                   
  hicolor-icon-theme-0.17-2.el8.noarch                                          
  jasper-libs-2.0.14-4.el8.x86_64                                               
  jbigkit-libs-2.1-14.el8.x86_64                                                
  lcms2-2.9-2.el8.x86_64                                                        
  libX11-xcb-1.6.8-3.el8.x86_64                                                 
  libXcomposite-0.4.4-14.el8.x86_64                                             
  libXcursor-1.1.15-3.el8.x86_64                                                
  libXdamage-1.1.4-14.el8.x86_64                                                
  libXdmcp-1.1.3-1.el8.x86_64                                                   
  libXfixes-5.0.3-7.el8.x86_64                                                  
  libXfont2-2.0.3-2.el8.x86_64                                                  
  libXft-2.3.3-1.el8.x86_64                                                     
  libXi-1.7.10-1.el8.x86_64                                                     
  libXinerama-1.1.4-1.el8.x86_64                                                
  libXrandr-1.5.2-1.el8.x86_64                                                  
  libXtst-1.2.3-7.el8.x86_64                                                    
  libXxf86vm-1.1.4-9.el8.x86_64                                                 
  libdatrie-0.2.9-7.el8.x86_64                                                  
  libdrm-2.4.101-1.el8.x86_64                                                   
  libepoxy-1.5.3-1.el8.x86_64                                                   
  libevdev-1.8.0-1.el8.x86_64                                                   
  libfontenc-1.1.3-8.el8.x86_64                                                 
  libglvnd-1:1.2.0-6.el8.x86_64                                                 
  libglvnd-egl-1:1.2.0-6.el8.x86_64                                             
  libglvnd-gles-1:1.2.0-6.el8.x86_64                                            
  libglvnd-glx-1:1.2.0-6.el8.x86_64                                             
  libglvnd-opengl-1:1.2.0-6.el8.x86_64                                          
  libinput-1.14.3-1.el8.x86_64                                                  
  libjpeg-turbo-1.5.3-10.el8.x86_64                                             
  libpciaccess-0.14-1.el8.x86_64                                                
  libthai-0.1.27-2.el8.x86_64                                                   
  libtiff-4.0.9-18.el8.x86_64                                                   
  libvdpau-1.4-2.el8.x86_64                                                     
  libwacom-1.1-3.el8.x86_64                                                     
  libwacom-data-1.1-3.el8.noarch                                                
  libwayland-client-1.17.0-1.el8.x86_64                                         
  libwayland-cursor-1.17.0-1.el8.x86_64                                         
  libwayland-egl-1.17.0-1.el8.x86_64                                            
  libwayland-server-1.17.0-1.el8.x86_64                                         
  libxkbfile-1.1.0-1.el8.x86_64                                                 
  libxshmfence-1.3-2.el8.x86_64                                                 
  llvm-libs-10.0.1-3.module_el8.3.0+467+cb298d5b.x86_64                         
  mesa-libEGL-20.1.4-1.el8.x86_64                                               
  mesa-libGL-20.1.4-1.el8.x86_64                                                
  mesa-libgbm-20.1.4-1.el8.x86_64                                               
  mesa-libglapi-20.1.4-1.el8.x86_64                                             
  mesa-vulkan-drivers-20.1.4-1.el8.x86_64                                       
  mtdev-1.1.5-12.el8.x86_64                                                     
  nvidia-x11-drv-libs-460.39-1.el8_3.elrepo.x86_64                              
  ocl-icd-2.2.12-1.el8.x86_64                                                   
  opencl-filesystem-1.0-6.el8.noarch                                            
  pango-1.42.4-6.el8.x86_64                                                     
  rest-0.8.1-2.el8.x86_64                                                       
  vulkan-loader-1.2.148.0-1.el8.x86_64                                          
  xorg-x11-drv-fbdev-0.5.0-2.el8.x86_64                                         
  xorg-x11-drv-libinput-0.29.0-1.el8.x86_64                                     
  xorg-x11-drv-vesa-2.4.0-3.el8.x86_64                                          
  xorg-x11-server-Xorg-1.20.8-6.1.el8_3.x86_64                                  
  xorg-x11-server-common-1.20.8-6.1.el8_3.x86_64                                
  xorg-x11-xkb-utils-7.7-28.el8.x86_64                                          

完毕!

(base) [root@cpanel ~]# find / -name 'libcuda.so.1'
/usr/lib64/libcuda.so.1
ok 安装成功
(base) [root@cpanel ~]# python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
2021-02-12 18:35:40.367376: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-02-12 18:35:41.468118: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-02-12 18:35:41.474028: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcuda.so.1
2021-02-12 18:35:41.505717: E tensorflow/stream_executor/cuda/cuda_driver.cc:328] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2021-02-12 18:35:41.505749: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (iZuf61u64hvs1nquuaipy8Z): /proc/driver/nvidia/version does not exist
2021-02-12 18:35:41.506146: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-02-12 18:35:41.506228: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
tf.Tensor(-2338.8306, shape=(), dtype=float32)

Successfully opened dynamic library libcuda.so.1

其余问题后面有时间再继续对应...

你可能感兴趣的:(python,pip,tensorflow)