当前位置: 首页 > news >正文

Windows11+CUDA12.0+RTX4090如何配置安装Tensorflow2-GPU环境?

1 引言

电脑配置
在这里插入图片描述

Windows 11
cuda 12.0
RTX4090

由于tensorflow2官网已经不支持cuda11以上的版本了,配置cuda和tensorflow可以通过以下步骤配置实现。

2 步骤

(1)创建conda环境并安装cuda和cudnn,以及安装tensorflow2.10

conda create -n tf39 python=3.9.*  numpy=1.20
conda activate tf39
conda install -c conda-forge cudatoolkit=11.8.*
pip install nvidia-cudnn-cu11
pip install tensorflow==2.10.*

完整的不冲突的包环境如下,包括sklearn、matplotlib、pandas等

absl-py                      2.1.0
anyio                        4.4.0
argon2-cffi                  23.1.0
argon2-cffi-bindings         21.2.0
arrow                        1.3.0
asttokens                    2.4.1
astunparse                   1.6.3
async-lru                    2.0.4
attrs                        23.2.0
Babel                        2.15.0
beautifulsoup4               4.12.3
bleach                       6.1.0
cachetools                   5.3.3
certifi                      2024.6.2
cffi                         1.16.0
charset-normalizer           3.3.2
clang                        5.0
clifford                     1.4.0
colorama                     0.4.6
comm                         0.2.2
contourpy                    1.2.1
cycler                       0.12.1
debugpy                      1.8.1
decorator                    5.1.1
defusedxml                   0.7.1
exceptiongroup               1.2.1
executing                    2.0.1
fastjsonschema               2.20.0
flatbuffers                  24.3.25
fonttools                    4.53.0
fqdn                         1.5.1
gast                         0.4.0
google-auth                  2.30.0
google-auth-oauthlib         0.4.6
google-pasta                 0.2.0
grpcio                       1.64.1
h11                          0.14.0
h5py                         3.6.0
httpcore                     1.0.5
httpx                        0.27.0
idna                         3.7
importlib_metadata           7.1.0
importlib_resources          6.4.0
install                      1.3.5
ipykernel                    6.29.4
ipython                      8.18.1
ipywidgets                   8.1.3
isoduration                  20.11.0
jedi                         0.19.1
Jinja2                       3.1.4
joblib                       1.2.0
json5                        0.9.25
jsonpointer                  3.0.0
jsonschema                   4.22.0
jsonschema-specifications    2023.12.1
jupyter                      1.0.0
jupyter_client               8.6.2
jupyter-console              6.6.3
jupyter_core                 5.7.2
jupyter-events               0.10.0
jupyter-lsp                  2.2.5
jupyter_server               2.14.1
jupyter_server_terminals     0.5.3
jupyterlab                   4.2.2
jupyterlab_pygments          0.3.0
jupyterlab_server            2.27.2
jupyterlab_widgets           3.0.11
keras                        2.10.0
Keras-Preprocessing          1.1.2
kiwisolver                   1.4.5
libclang                     18.1.1
llvmlite                     0.36.0
Markdown                     3.6
MarkupSafe                   2.1.5
matplotlib                   3.3.4
matplotlib-inline            0.1.7
mistune                      3.0.2
mpl-toolkits.clifford        0.0.3
nbclient                     0.10.0
nbconvert                    7.16.4
nbformat                     5.10.4
nest-asyncio                 1.6.0
notebook                     7.2.1
notebook_shim                0.2.4
numba                        0.53.0
numpy                        1.20.0
nvidia-cublas-cu11           11.11.3.6
nvidia-cuda-nvrtc-cu11       11.8.89
nvidia-cudnn-cu11            9.1.1.17
oauthlib                     3.2.2
opt-einsum                   3.3.0
overrides                    7.7.0
packaging                    24.1
pandas                       1.4.0
pandocfilters                1.5.1
parso                        0.8.4
pillow                       10.3.0
pip                          24.0
platformdirs                 4.2.2
prometheus_client            0.20.0
prompt_toolkit               3.0.47
protobuf                     3.19.6
psutil                       6.0.0
pure-eval                    0.2.2
pyasn1                       0.6.0
pyasn1_modules               0.4.0
pycparser                    2.22
Pygments                     2.18.0
pyparsing                    3.1.2
python-dateutil              2.9.0.post0
python-json-logger           2.0.7
pytz                         2024.1
pywin32                      306
pywinpty                     2.0.13
PyYAML                       6.0.1
pyzmq                        26.0.3
qtconsole                    5.5.2
QtPy                         2.4.1
referencing                  0.35.1
requests                     2.32.3
requests-oauthlib            2.0.0
rfc3339-validator            0.1.4
rfc3986-validator            0.1.1
rpds-py                      0.18.1
rsa                          4.9
scikit-learn                 1.5.0
scipy                        1.10.0
Send2Trash                   1.8.3
setuptools                   69.5.1
six                          1.15.0
sniffio                      1.3.1
soupsieve                    2.5
sparse                       0.15.4
stack-data                   0.6.3
tensorboard                  2.10.1
tensorboard-data-server      0.6.1
tensorboard-plugin-wit       1.8.1
tensorflow                   2.10.1
tensorflow-estimator         2.10.0
tensorflow-io-gcs-filesystem 0.31.0
termcolor                    1.1.0
terminado                    0.18.1
threadpoolctl                3.1.0
tinycss2                     1.3.0
tomli                        2.0.1
tornado                      6.4.1
traitlets                    5.14.3
trimesh                      4.4.1
types-python-dateutil        2.9.0.20240316
typing_extensions            4.12.2
tzdata                       2024.1
uri-template                 1.3.0
urllib3                      2.2.2
wcwidth                      0.2.13
webcolors                    24.6.0
webencodings                 0.5.1
websocket-client             1.8.0
Werkzeug                     3.0.3
wheel                        0.43.0
widgetsnbextension           4.0.11
wrapt                        1.12.1
zipp                         3.19.2

(2)添加环境变量

D:\ProgramData\anaconda3\envs\tf39\Lib\site-packages\nvidia\cudnn\bin

(3)测试

import tensorflow as tf
print(tf.test.is_gpu_available())

如果报错”tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cudnn64_8.dll’; dlerror: cudnn64_8.dll not found”
请将路径D:\ProgramData\anaconda3\envs\tf39\Lib\site-packages\nvidia\cudnn\bin下的’cudnn64_8.dll’重命名为’cudnn64_9.dll’。注意先复制一个文件后备份,再重命名。

http://www.lryc.cn/news/377728.html

相关文章:

  • 韩顺平0基础学Java——第27天
  • YesPMP探索Python在生活中的应用,助力提升开发效率
  • TikTok账号运营:静态住宅IP为什么可以防封?
  • linux系统宝塔服务器temp文件夹里总是被上传病毒php脚本
  • HTML+CSS+PHP实现网页留言板功能(需要创建数据库)
  • 【谷歌】实用的搜索技巧
  • 打造完美启动页:关键策略与设计技巧
  • 电子书(chm)-加载JS--CS上线
  • 理解HTTP请求格式
  • 差分数组汇总
  • SpringBoot | 实现邮件发送
  • spring boot接入nacos 配置中心
  • 产品应用 | 小盒子跑大模型!英码科技基于算能BM1684X平台实现大模型私有化部署
  • uniapp中u-input点击事件失效
  • [机器学习] 监督学习和无监督学习
  • 使用Python进行自然语言处理:从基础到实战
  • Hadoop面试题总结
  • 关于IntelliJ IDEA 2024.1版本更新的问题
  • 双层循环和循环语句
  • 【Codesys】-计算开机通电运行时间,累计正常使用时间,故障停机时间
  • LINUX系统编程:线程的概念
  • 如何更换OpenHarmony SDK API 10
  • Java | Leetcode Java题解之第155题最小栈
  • 大润发超市购物卡怎么用?
  • 【ai】tx2-nx:搭配torch的torchvision
  • 深入浅出MyBatis:全面解析与实战指南
  • 好用的linux一键换源脚本
  • 机器人----控制方式
  • json的特点
  • 【2024最新华为OD-C/D卷试题汇总】[支持在线评测] 连续字母长度(100分) - 三语言AC题解(Python/Java/Cpp)