本来安装tensorflow-gpu是一句话的事情,但因为版本变动,今天安装遇到很多麻烦,简单记录

​ 之前是装了tensorflow-gpu==2.6.0的版本的,但后来在这个环境中安装了sionna,这个可恶的库居然直接卸载了我的tensorflow-gpu==2.6.0,安装了满足它要求的13版本tensorflow,而且还是cpu版本的,安装之前都没问我要不要安装,真可恶啊,导致我不得不重新安装tensorflow-gpu

​ 首先创建3.9版本python环境,然后conda install tensorflow-gpu==2.6.0安装,记得科学上网

​ 安装完后,再conda install keras==2.6.0安装keras

​ 这时候已经自动安装了cudatoolkit、cudnn、tensorflow-gpu、keras、numpy等

​ 你以为行了?

print(tf.__version__)报错,说是numpy不再有object属性,那可以推断numpy版本过高,pip卸载numpy重新安装低版本即可(后来知道,只需要不停的降低版本,就能试出来符合要求的版本)

​ 但是,重新安装numpy后又会报各种不兼容问题,其实这个问题我们不用管,当我去管它,又会出现各种各种的兼容问题,所以直接不管!具体原因我推测是那些提示版本不兼容的包,实际我们很难使用到

列出一个tensorflow-gpu==2.6.0能用的版本软件:

_tflow_select 2.1.0 gpu
abseil-cpp 20210324.2 h0e60522_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
absl-py 2.0.0 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
aiohttp 3.8.5 py39ha55989b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
aiosignal 1.3.1 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
astor 0.8.1 pyh9f0ad1d_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
astunparse 1.6.3 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
async-timeout 4.0.3 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
attrs 23.1.0 pyh71513ae_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
blinker 1.6.2 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
brotli-python 1.1.0 py39h99910a6_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
bzip2 1.0.8 h8ffe710_4 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
ca-certificates 2023.7.22 h56e8100_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cached-property 1.5.2 hd8ed1ab_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cached_property 1.5.2 pyha770c72_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cachetools 4.2.4 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
certifi 2023.7.22 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cffi 1.15.1 py39ha55989b_5 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
charset-normalizer 3.2.0 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
click 8.1.7 win_pyh7428d3b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
colorama 0.4.6 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cryptography 39.0.0 py39h58e9bdb_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cudatoolkit 11.3.1 hf2f0253_12 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cudnn 8.2.1.32 h754d62a_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
flatbuffers 23.5.26 h63175ca_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
frozenlist 1.4.0 py39ha55989b_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
gast 0.4.0 pyh9f0ad1d_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
giflib 5.2.1 h64bf75a_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
google-auth 1.35.0 pyh6c4a22f_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
google-auth-oauthlib 0.4.6 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
google-pasta 0.2.0 pyh8c360ce_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
grpcio 1.46.3 py39hb76b349_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
h5py 3.9.0 nompi_py39h9c8e182_100 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
hdf5 1.14.0 nompi_h97a5375_103 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
icu 68.2 h0e60522_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
idna 3.4 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
importlib-metadata 6.8.0 pyha770c72_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
intel-openmp 2023.2.0 h57928b3_49503 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
jpeg 9e hcfcfb64_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
keras 2.6.0 pyhd3eb1b0_0
keras-preprocessing 1.1.2 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
keyboard 0.13.5 pypi_0 pypi
krb5 1.20.1 h6609f42_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libaec 1.0.6 h63175ca_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libblas 3.9.0 18_win64_mkl https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libcblas 3.9.0 18_win64_mkl https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libcurl 8.1.2 h68f0423_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libffi 3.4.2 h8ffe710_5 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libhwloc 2.9.3 default_haede6df_1009 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libiconv 1.17 h8ffe710_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
liblapack 3.9.0 18_win64_mkl https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libpng 1.6.39 h19919ed_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libprotobuf 3.17.2 h7755175_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libsqlite 3.43.0 hcfcfb64_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libssh2 1.10.0 h680486a_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libxml2 2.11.5 hc3477c8_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libzlib 1.2.13 hcfcfb64_5 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
m2w64-gcc-libgfortran 5.3.0 6 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2
m2w64-gcc-libs 5.3.0 7 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2
m2w64-gcc-libs-core 5.3.0 7 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2
m2w64-gmp 6.1.0 2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2
m2w64-libwinpthread-git 5.0.0.4634.697f757 2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2
markdown 3.4.4 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
markupsafe 2.1.3 py39ha55989b_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
mkl 2022.1.0 h6a75c08_874 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
msys2-conda-epoch 20160418 1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2
multidict 6.0.4 py39ha55989b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
numpy 1.23.0 pypi_0 pypi
oauthlib 3.2.2 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
opencv-contrib-python 4.8.0.76 pypi_0 pypi
openssl 1.1.1w hcfcfb64_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
opt_einsum 3.3.0 pyhd8ed1ab_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pillow 10.0.1 pypi_0 pypi
pip 23.2.1 pypi_0 pypi
protobuf 3.17.2 py39h415ef7b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pthreads-win32 2.9.1 hfa6e2cd_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pyasn1 0.5.0 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pyasn1-modules 0.3.0 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pycparser 2.21 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pyjwt 2.8.0 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pyopenssl 23.2.0 pyhd8ed1ab_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pysocks 1.7.1 pyh0701188_6 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
python 3.9.15 h0269646_0_cpython https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
python-flatbuffers 1.12 pyhd8ed1ab_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
python_abi 3.9 4_cp39 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pyu2f 0.1.5 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
requests 2.31.0 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
requests-oauthlib 1.3.1 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
rsa 4.9 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
scipy 1.11.2 py39h7812ad6_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
setuptools 68.2.2 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
six 1.16.0 pyh6c4a22f_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
snappy 1.1.10 hfb803bf_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
sqlite 3.43.0 hcfcfb64_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
tbb 2021.10.0 h91493d7_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
tensorboard 2.6.0 pyhd8ed1ab_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
tensorboard-data-server 0.6.1 py39hcbf5309_4 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
tensorboard-plugin-wit 1.8.1 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
tensorflow 2.6.0 gpu_py39he88c5ba_0
tensorflow-base 2.6.0 gpu_py39hb3da07e_0
tensorflow-estimator 2.6.0 pyh7b7c402_0
vc14_runtime 14.36.32532 hdcecf7f_17 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
vs2015_runtime 14.36.32532 h05e6639_17 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
werkzeug 2.3.7 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
wheel 0.35.1 pyh9f0ad1d_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
win_inet_pton 1.1.0 pyhd8ed1ab_6 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
wrapt 1.15.0 py39ha55989b_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
xz 5.2.6 h8d14728_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
yarl 1.9.2 py39ha55989b_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
zipp 3.17.0 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
zlib 1.2.13 hcfcfb64_5 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge