tensorflow - 无法将 tensorflow 导入我的 python 代码

标签 tensorflow machine-learning dll

我正在尝试将 tensorflow 模型导入到我的代码中,但它总是向我抛出 dll 链接错误,我尝试安装各种版本,但似乎都不起作用。

我安装了多个版本的tensorflow 卸载并重新安装anaconda 尝试使用wheelfiles安装tensorflow

ImportError: Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\ProgramData\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:\ProgramData\Anaconda3\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\ProgramData\Anaconda3\lib\imp.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

我希望tensorflow能够在我的机器上成功安装并运行

注意:我使用 Windows 10 操作系统

最佳答案

我认为问题可能是由于protobuf造成的,尝试使用以下方法将protobuf降级到3.6.0:

pip install protobuf==3.6.0

如果没有尝试使用以下链接中提供的wheel文件安装tensorflow:

https://github.com/fo40225/tensorflow-windows-wheel/tree/master/1.12.0/py36/CPU/sse2

希望这可以解决您的问题。

关于tensorflow - 无法将 tensorflow 导入我的 python 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56034796/

相关文章:

c++ - 从C++ dll调用Go dll

python - 导入 tensorflow 错误: DLL load failed: The specified procedure could not be found

python - Flask 和 Keras 模型错误 '' _thread._local' object has no attribute 'value''?

c - libsndfile Windows 7

java - 使用java libsvm的文本分类——模型、参数选择

python - Keras——使用 LSTM 层时精度较低,但不使用 LSTM 时精度很好

c++ - 使用 CreateRemoteThread 注入(inject) DLL

tensorflow - 理解 C++ 中新 Tensorflow 运算符的定义

python-3.x - Raspberry Pi3 上的 Tensorflow 1.5

python - 为什么 `xavier_initializer()`和 `glorot_uniform_initializer()`在某种程度上是重复的?