conda环境下使用pip install tensorflow-gpu==2.1.0安装Tensorflow2.1.0后,在python中导入时报错:
File "E:\Anaconda3\envs\tensorflow2.1.0\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import
File "E:\PyCharm Community Edition 2019.1.1\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, args, **kwargs)
File "E:\Anaconda3\envs\tensorflow2.1.0\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "E:\Anaconda3\envs\tensorflow2.1.0\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "E:\Anaconda3\envs\tensorflow2.1.0\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "E:\Anaconda3\envs\tensorflow2.1.0\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。
根据官网要求,我的CUDA是10.1版本,python是3.7.6,应该是符合的。并且环境变量都添加正确了。像Numpy包导入都没问题,下面是我在该环境下conda list 出的包:
absl-py 0.9.0 <pip>
astor 0.8.1 <pip>
ca-certificates 2020.1.1 0
cachetools 4.0.0 <pip>
certifi 2019.11.28 py37_0
chardet 3.0.4 <pip>
gast 0.2.2 <pip>
google-auth 1.11.2 <pip>
google-auth-oauthlib 0.4.1 <pip>
google-pasta 0.1.8 <pip>
grpcio 1.27.2 <pip>
h5py 2.10.0 <pip>
idna 2.8 <pip>
Keras-Applications 1.0.8 <pip>
Keras-Preprocessing 1.1.0 <pip>
Markdown 3.2.1 <pip>
numpy 1.18.1 <pip>
oauthlib 3.1.0 <pip>
openssl 1.1.1d he774522_4
opt-einsum 3.1.0 <pip>
pip 20.0.2 py37_1
protobuf 3.11.3 <pip>
pyasn1 0.4.8 <pip>
pyasn1-modules 0.2.8 <pip>
python 3.7.6 h60c2a47_2
requests 2.22.0 <pip>
requests-oauthlib 1.3.0 <pip>
rsa 4.0 <pip>
scipy 1.4.1 <pip>
setuptools 45.2.0 py37_0
six 1.14.0 <pip>
sqlite 3.31.1 he774522_0
tensorboard 2.1.0 <pip>
tensorflow-gpu 2.1.0 <pip>
tensorflow-gpu-estimator 2.1.0 <pip>
termcolor 1.1.0 <pip>
urllib3 1.25.8 <pip>
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_1
Werkzeug 1.0.0 <pip>
wheel 0.34.2 py37_0
wincertstore 0.2 py37_0
wrapt 1.12.0 <pip>
为什么会出这样的错,该怎么解决呢
大侠,我和你一样,折腾很久
解决方法:
换版本,pip install tensorflow-gpu==1.15.0
成功:参考https://www.cnblogs.com/lry1/p/12913500.html