会网站开发 不会软件电商网站的商品主图
web/
2025/10/8 10:09:14/
文章来源:
会网站开发 不会软件,电商网站的商品主图,大岭山网站,自媒体平台账号注册学习新技术有两座大山#xff0c;一座是安装配置环境#xff0c;另一座是调试bug。对于想学习人工智能开发的人来说#xff0c;安装配置tensorflow是必不可少的一步#xff0c;这个过程对于初次接触的人来说#xff0c;到处都是火坑。下面大家跟我一起#xff0c;看看都会…学习新技术有两座大山一座是安装配置环境另一座是调试bug。对于想学习人工智能开发的人来说安装配置tensorflow是必不可少的一步这个过程对于初次接触的人来说到处都是火坑。下面大家跟我一起看看都会踩到哪些雷 一、安装tensorflow如果安装tensorflow CPU版本可以用这个命令pip install tensorflow如果安装tensorflow GPU版本可以用这个命令pip install tensorflow-gpu但这样的话因为访问的是国外的网站速度慢的会让你怀疑人生所以我强烈建议大家用国内清华源的镜像如果安装CPU版pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow如果安装GPU版pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-gpu但有时使用清华源的地址网络总是莫名其妙的中断碰到这种情况可以换豆瓣源的镜像地址https://pypi.douban.com/simple试试一般就OK了。二、测试tensorflow安装是否成功打印一下版本号看一下安装是否成功import tensorflow as tfprint(tf.__version__)如果正常显示tensorflow的版本号则一切OK但如果出现下面的错误提示Failed to load the native TensorFlow runtime.Traceback (most recent call last):File ipython-input-6-64156d691fe5, line 1, in moduleimport tensorflow as tfFile C:UsersHonorVanAppDataRoamingPythonPython36site-packagestensorflow__init__.py, line 24, in modulefrom tensorflow.python import pywrap_tensorflow # pylint: disableunused-importFile C:UsersHonorVanAppDataRoamingPythonPython36site-packagestensorflowpython__init__.py, line 49, in modulefrom tensorflow.python import pywrap_tensorflowFile C:UsersHonorVanAppDataRoamingPythonPython36site-packagestensorflowpythonpywrap_tensorflow.py, line 74, in moduleraise ImportError(msg)ImportError: Traceback (most recent call last):File C:UsersHonorVanAppDataRoamingPythonPython36site-packagestensorflowpythonpywrap_tensorflow.py, line 58, in modulefrom tensorflow.python.pywrap_tensorflow_internal import *File C:UsersHonorVanAppDataRoamingPythonPython36site-packagestensorflowpythonpywrap_tensorflow_internal.py, line 28, in module_pywrap_tensorflow_internal swig_import_helper()File C:UsersHonorVanAppDataRoamingPythonPython36site-packagestensorflowpythonpywrap_tensorflow_internal.py, line 24, in swig_import_helper_mod imp.load_module(_pywrap_tensorflow_internal, fp, pathname, description)File D:ProgramDataAnaconda3libimp.py, line 243, in load_modulereturn load_dynamic(name, filename, file)File D:ProgramDataAnaconda3libimp.py, line 343, in load_dynamicreturn _load(spec)
ImportError: DLL load failed: 找不到指定的模块。Failed to load the native TensorFlow runtime.See https://www.tensorflow.org/install/errorsfor some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.有人说是因为python版本和tensorflow版本不匹配要么降低python版本要么降低tensorflow版本。如果不是python版本和tensorflow版本不匹配比如我的当前环境为python3.6.5安装tensorflow的版本为2.2win10 64位pip 20.0版本完全匹配呀~ 那是为什么呢如果你前面配置的是CPU版可能是缺少类库MSVCP140.DLL。那么在这个地址https://www.microsoft.com/en-us/download/details.aspx?id53587下载安装即可。这样就能搞定CPU版的tensorflow。三、搞定tensorflow GPU版的问题如果你安装的是GPU版那么接着安装cuda和cudnn正常next就可以了只需要注意环境变量path配一下把cudnn的文件复制到cuda的目录里就OK了。但是tensorflow对cuda和cudnn的版本也有要求。tensorflow2.2通过官网了解只能对应装10.1版本的cuda10.0的还不行。然后再找10.1cuda对应的cudnn7.6.5。这个显卡加速库就算是安装成功了。但如果报驱动和运行版本不对应的错误CUDA driver version is insufficient for CUDA runtime versionailed.可能需要卸载工具包再安装对应的版本。pip uninstall cudnn pip uninstall cudatoolkit但在卸载前要先用pip list 命令看看有没有这些东东。如果没有你可以尝试更新显卡驱动到英伟达官网https://www.nvidia.cn/Download/index.aspx?langcn选择对应的显卡型号更新即可。比如我的显卡是老掉渣的GTX1060最后显示一切OK。I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1060 computeCapability: 6.1
coreClock: 1.6705GHz coreCount: 10 deviceMemorySize: 6.00GiB deviceMemoryBandwidth: 178.99GiB/s
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x22345614f70 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default VersionI tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1060 computeCapability: 6.1
coreClock: 1.6705GHz coreCount: 10 deviceMemorySize: 6.00GiB deviceMemoryBandwidth: 178.99GiB/s
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix:
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108] 0
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1121] 0: N
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1247] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4700 MB memory) - physical GPU (device: 0, name: GeForce GTX 1060, pci bus id: 0000:01:00.0, compute capability: 6.1)
I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x223673b0e90 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): GeForce GTX 1060, Compute Capability 6.1总的来说CPU版比较简单GPU版坑比较多。
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/88993.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!