最近开始学习tensorflow,电脑是win10 64位系统的,已经安装了python3.6.1 32位的,tensorflow只支持python64位的,所以直接安装了Python64位3.6.1。直接使用pip install tensorflow安装,安装的是1.8.0版本,安装好后在命令行中执行import tensorflow出现问题,无法成功,现象如下:
Microsoft Windows [版本 10.0.16299.371]
(c) 2017 Microsoft Corporation。保留所有权利。
(c) 2017 Microsoft Corporation。保留所有权利。
C:\Users\zhaoshimin>python
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import tensorflow
Traceback (most recent call last):
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 14, in swig_import_helper
return importlib.import_module(mname)
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “<frozen importlib._bootstrap>”, line 978, in _gcd_import
File “<frozen importlib._bootstrap>”, line 961, in _find_and_load
File “<frozen importlib._bootstrap>”, line 950, in _find_and_load_unlocked
File “<frozen importlib._bootstrap>”, line 648, in _load_unlocked
File “<frozen importlib._bootstrap>”, line 560, in module_from_spec
File “<frozen importlib._bootstrap_external>”, line 922, in create_module
File “<frozen importlib._bootstrap>”, line 205, in _call_with_frames_removed
ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import tensorflow
Traceback (most recent call last):
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 14, in swig_import_helper
return importlib.import_module(mname)
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “<frozen importlib._bootstrap>”, line 978, in _gcd_import
File “<frozen importlib._bootstrap>”, line 961, in _find_and_load
File “<frozen importlib._bootstrap>”, line 950, in _find_and_load_unlocked
File “<frozen importlib._bootstrap>”, line 648, in _load_unlocked
File “<frozen importlib._bootstrap>”, line 560, in module_from_spec
File “<frozen importlib._bootstrap_external>”, line 922, in create_module
File “<frozen importlib._bootstrap>”, line 205, in _call_with_frames_removed
ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 17, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 16, in swig_import_helper
return importlib.import_module(‘_pywrap_tensorflow_internal’)
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named ‘_pywrap_tensorflow_internal’
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 17, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 16, in swig_import_helper
return importlib.import_module(‘_pywrap_tensorflow_internal’)
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named ‘_pywrap_tensorflow_internal’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py”, line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py”, line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 14, in swig_import_helper
return importlib.import_module(mname)
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “<frozen importlib._bootstrap>”, line 978, in _gcd_import
File “<frozen importlib._bootstrap>”, line 961, in _find_and_load
File “<frozen importlib._bootstrap>”, line 950, in _find_and_load_unlocked
File “<frozen importlib._bootstrap>”, line 648, in _load_unlocked
File “<frozen importlib._bootstrap>”, line 560, in module_from_spec
File “<frozen importlib._bootstrap_external>”, line 922, in create_module
File “<frozen importlib._bootstrap>”, line 205, in _call_with_frames_removed
ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。
File “<stdin>”, line 1, in <module>
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py”, line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py”, line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 14, in swig_import_helper
return importlib.import_module(mname)
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “<frozen importlib._bootstrap>”, line 978, in _gcd_import
File “<frozen importlib._bootstrap>”, line 961, in _find_and_load
File “<frozen importlib._bootstrap>”, line 950, in _find_and_load_unlocked
File “<frozen importlib._bootstrap>”, line 648, in _load_unlocked
File “<frozen importlib._bootstrap>”, line 560, in module_from_spec
File “<frozen importlib._bootstrap_external>”, line 922, in create_module
File “<frozen importlib._bootstrap>”, line 205, in _call_with_frames_removed
ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 17, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 16, in swig_import_helper
return importlib.import_module(‘_pywrap_tensorflow_internal’)
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named ‘_pywrap_tensorflow_internal’
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 17, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 16, in swig_import_helper
return importlib.import_module(‘_pywrap_tensorflow_internal’)
File “C:\Users\zhaoshimin\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named ‘_pywrap_tensorflow_internal’
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
above this error message when asking for help.
1、经过网上搜索,参考
windows上安装tensorflow时报错,“DLL load failed: 找不到指定的模块”的解决方式_爱武侠的程序员的博客-CSDN博客的解答是没有安装vc64位运行库,直接微软件官网下载了,安装后,执行import tensorflow还是老样子。
windows上安装tensorflow时报错,“DLL load failed: 找不到指定的模块”的解决方式_爱武侠的程序员的博客-CSDN博客的解答是没有安装vc64位运行库,直接微软件官网下载了,安装后,执行import tensorflow还是老样子。
2、看来问题还是没有解决,继续搜索,找到了这个
博文的解决法,试过之后可以了。
博文的解决法,试过之后可以了。
问题的原因是我的电脑(联想V460)的cpu比较老,不支持AVX指令导致的,需要安装特殊编译的
tensorflow 1.6.0版本才可以解决,注意安装时要先卸载先前安装的1.8.0版本。关于这个问题的详细解决过程可以参考
github上面tensorflow的论坛。
tensorflow 1.6.0版本才可以解决,注意安装时要先卸载先前安装的1.8.0版本。关于这个问题的详细解决过程可以参考
github上面tensorflow的论坛。
以上两步操作完成,问题解决了。编写一个简单的程序测试一下,OK了。
把上面的代码写到py文件中,使用python 3.6 shell运行,出现不识别tensorflow模块的问题。
分析原因是由于电脑上同时安装了python 3.6.1 32位和64位的问题,shell运行时还是加载的32位python的安装包,所以还要想办法解决一下32位和64位shell同时共存的问题,因为python3.6.1 32位已经编写了很多软件,还不能卸载。
这个问题解决的,原因很简单,定义用于测试的文件不能命名使用tensorflow.py,换成其他名字就好了。python32, python64在同一个电脑的包管路径是不会冲突的,不需要做额外修改。
今天的文章flow3d安装教程_flow3d安装教程「建议收藏」分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/72534.html