我刚在新笔记本上安装了tensorflow。在Spyder中导入张量流时出错
(蟒蛇4.3.24,Python的3.6.1,TensorFlow:1.2.1,GPU:NVIDIA 1060 6GB)目前
四个问题。
{1} “未能加载天然TensorFlow运行时” 错误在Spyder的
File "D:/Programs/Codes-Python/OpenCVtest.py", line 13, in <module>
import tensorflow as tf
File "D:\Programs\Anaconda\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "D:\Programs\Anaconda\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "D:\Programs\Anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "D:\Programs\Anaconda\lib\site-
packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in
swig_import_helper
return importlib.import_module(mname)
File "D:\Programs\Anaconda\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: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Programs\Anaconda\lib\site-
packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\Programs\Anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\Programs\Anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "D:\Programs\Anaconda\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.
{2} ...但tensorflow负载而不会从命令提示符(多)问题
令人困惑的是,当我通过anaconda提示加载tensorflow - >激活tensorflow - > python - >导入tensorflow时:导入tensorflow时没有错误。
怎么回事?如果tensorflow库只安装了某些环境中Spyder的错误消息应该是“无模块命名TensorFlow” ......
{3}有些不符运行的例子
当现在,当我运行anaconda提示中的测试代码:
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
我得到以下“错误”?
2017-08-14 23:39:37.137745: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations.
2017-08-14 23:39:37.137929: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations.
2017-08-14 23:39:37.139157: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
2017-08-14 23:39:37.139677: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-08-14 23:39:37.140599: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-08-14 23:39:37.141239: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-08-14 23:39:37.141915: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-08-14 23:39:37.142529: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
但我仍然可以运行测试“打印(sess.run(你好))”的最后一部分,得到以下结果。
>>> print(sess.run(hello))
b'Hello, TensorFlow!'
在你面前的'b'不应该在那里,但是当我运行代码时总是存在。为什么?
{4}没有已知的设备错误 - GPU无法识别? 最后,当我检查正在使用的设备时,tensorflow似乎无法识别GPU。为什么?我尝试卸载,重新安装tensorflow和tensorflow-GPU分开无济于事。
>>> sess = tf.Session(config = tf.ConfigProto(log_device_placement=True))
Device mapping: no known devices.
2017-08-14 23:50:42.624086: I c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\common_runtime\direct_session.cc:265] Device mapping:
任何帮助将不胜感激。 谢谢, CN
谢谢,罗宾。 CUDA 8.0(和cuDNN)已经安装,尽管现在我不确定它是否被正确安装。 NVIDIA的示例程序不再用于验证安装。 – CockneyNinja