简体   繁体   English

无法在具有 64 位 anaconda 的 64 位系统上使用 python 3.6 版本在 anaconda 上导入 tensorflow

[英]Not able to import tensorflow on anaconda with python 3.6 version on 64bit system with 64bit anaconda

When I import tensorflow it gives me this error:当我导入 tensorflow 时,它给了我这个错误:

Traceback (most recent call last): File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\\Users\\User\\Anaconda3\\lib\\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\\Users\\User\\Anaconda3\\lib\\imp.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.回溯(最近一次调用):文件“C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow.py”,第 58 行,来自 tensorflow.python.pywrap_tensorflow_internal import * 文件“C: \\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow_internal.py”,第 28 行,在 _pywrap_tensorflow_internal = swig_import_helper() 文件“C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\ python\\pywrap_tensorflow_internal.py”,第 24 行,在 swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) 文件“C:\\Users\\User\\Anaconda3\\lib\\imp.py”,第 243 行,在load_module return load_dynamic(name, filename, file) File "C:\\Users\\User\\Anaconda3\\lib\\imp.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed: A dynamic link library (DLL ) 初始化例程失败。

During handling of the above exception, another exception occurred:在处理上述异常的过程中,又发生了一个异常:

Traceback (most recent call last): File "", line 1, in import tensorflow as tf File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow__init__.py", line 24, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow_internal.py", line 24, in swig_import_hel回溯(最近一次调用):文件“”,第 1 行,在导入 tensorflow 中作为 tf 文件“C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow__init__.py”,第 24 行,来自 tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\\Users \\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow.py”,第 74 行,在 raise ImportError(msg) ImportError: Traceback (last last call last): File "C:\\Users\\User\\Anaconda3\\ lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow.py”,第 58 行,来自 tensorflow.python.pywrap_tensorflow_internal 导入 * 文件“C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow_internal。 py”,第 28 行,在 _pywrap_tensorflow_internal = swig_import_helper() 文件“C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow_internal.py”,第 24 行,在 swig_import_hel per _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\\Users\\User\\Anaconda3\\lib\\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\\Users\\User\\Anaconda3\\lib\\imp.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed. per _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\\Users\\User\\Anaconda3\\lib\\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File “C:\\Users\\User\\Anaconda3\\lib\\imp.py”,第 343 行,在 load_dynamic 返回 _load(spec) ImportError: DLL load failed: A dynamic link library (DLL) 初始化例程失败。

Failed to load the native TensorFlow runtime.无法加载本机 TensorFlow 运行时。

See https://www.tensorflow.org/install/errors请参阅https://www.tensorflow.org/install/errors

Please Help me with this请在这件事上给予我帮助

The following might me the problems :以下可能是我的问题:

  • You have not installed Microsoft C++ Redist 2015 Update 3. It contains the missing dll.您尚未安装 Microsoft C++ Redist 2015 Update 3。它包含缺少的 dll。 You need to download the 2015 update 3 version only.您只需要下载 2015 update 3 版本。

  • Your CPU doesn't support AVX instructions which are needed by TensorFlow.您的 CPU 不支持 TensorFlow 所需的 AVX 指令。 You will need a processer which supports AVX.您将需要一个支持 AVX 的处理器。

I just solved this same issue with my system (Win 10, 64 bit).我刚刚用我的系统(Win 10、64 位)解决了同样的问题。 Following are the details of how I resolved this issue:以下是我如何解决此问题的详细信息:

  1. Install VS 2017 , tensorflow doesn't use it but having it helps in the smooth installation of CUDA toolkit.安装VS 2017 ,tensorflow 不使用它,但它有助于 CUDA 工具包的顺利安装。
  2. Update NVDIA driver from windows device manager .从 Windows 设备管理器更新NVDIA 驱动程序
  3. Download and Install CUDA toolkit (version 10.1) .下载并安装CUDA 工具包(版本 10.1)
  4. Download and unzip CUDnn 7.6.5 .下载并解压CUDnn 7.6.5 Copy the extracted files into a folder in C drive.将提取的文件复制到C盘的文件夹中。
  5. Add ~\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bin , ~\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bin and cudnn-10.1-windows10-x64-v7.6.4.38\\cuda\\bin to PATH添加~\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bin~\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bincudnn-10.1-windows10-x64-v7.6.4.38\\cuda\\bin到 PATH

Doing import tensorflow as tf after the above steps solved the issue.在上述步骤解决问题后, import tensorflow as tf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM