我最近开始进入Tensorflow,但我遇到了安装问题.每次我尝试导入它时,我都会收到以下错误
>>> import tensorflow as tf Traceback (most recent call last): File "C:\Users\[user]\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\[user]\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 994,in _gcd_import File "<frozen importlib._bootstrap>",line 971,in _find_and_load File "<frozen importlib._bootstrap>",line 955,in _find_and_load_unlocked File "<frozen importlib._bootstrap>",line 658,in _load_unlocked File "<frozen importlib._bootstrap>",line 571,in module_from_spec File "<frozen importlib._bootstrap_external>",line 922,in create_module File "<frozen importlib._bootstrap>",line 219,in _call_with_frames_removed ImportError: DLL load Failed: A dynamic link library (DLL) initialization routine Failed. During handling of the above exception,another exception occurred: Traceback (most recent call last): File "C:\Users\[user]\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\[user]\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\[user]\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\[user]\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py",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\[user]\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\[user]\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\[user]\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\[user]\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",level) ModuleNotFoundError: No module named '_pywrap_tensorflow_internal' Failed to load the native TensorFlow runtime.
我查看了与我有同样问题的其他堆栈溢出帖子,他们建议从NVIDIA获取CUDA库.问题是,我既没有NVIDIA显卡也没有GPU版本的张量流,所以我不认为这是问题所在.还有一些建议可以确保安装Visual Studio的Microsoft可再发行组件.
如果这是一个基于系统变量的问题,我很感激帮助改变系统变量,因为我是新手.谢谢!
一些系统信息:
>操作系统:Microsoft Windows 10 Pro版本10.0.17134
> cpu:Intel Xeon E5620
>显卡:Radeon RX 480
> Python版本:3.6.5 amd64 Tensorflow
>安装方法:pip install tensorflow
我的猜测是你试图使用TF> = 1.6,因为你的cpu相当老,不支持AVX指令.确实从1.6上,tensorflow pre-built binaries use AVX instructions.
目前您的选择是:
>使用TF 1.5或更早版本的官方预构建二进制文件. (你会错过一些事情,但我会说).
>搜索不支持AVX的TF> = 1.6的非官方预构建二进制文件.
>目前,从Windows上的conda安装到TF 1.10之前预先构建的二进制文件似乎不是用AVX支持构建的,虽然我无法在任何地方找到这些信息,因此无法判断这是否是故意的以及情况会持续多长时间.
>请注意,另一方面来自conda-forge的二进制文件(在主要通道上可用之前曾是主要的conda tensorflow提供程序)是使用AVX支持构建的.
>更改硬件以支持AVX(显然).>在没有AVX指令的情况下编译自己的tensorflow二进制文件.如果没有其他可能的话,这是一个合理的选择.