[英]Anaconda+Spyder+Windows Tensorflow installation
主題描述了問題。 我無法在Windows的Anaconda withtiny Spyder IDE中安裝TF並使用它。 在此腳本中的TF GPU v0.12.1的安裝成功完成:
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.1-cp35-cp35m-win_amd64.whl
但是,我仍然收到此錯誤:
Traceback (most recent call last):
File "<ipython-input-1-a2e3a001c740>", line 1, in <module>
runfile('D:/ERP/SRC/WorkloadPrediction/PythonScripts/test_pys/test_TF.py', wdir='D:/ERP/SRC/WorkloadPrediction/PythonScripts/test_pys')
File "D:\Programs\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
execfile(filename, namespace)
File "D:\Programs\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/ERP/SRC/WorkloadPrediction/PythonScripts/test_pys/test_TF.py", line 8, in <module>
import tensorflow as tf
File "D:\Programs\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "D:\Programs\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 60, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "D:\Programs\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "D:\Programs\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, 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 "D:\Programs\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 54, in <module>
from tensorflow.python import pywrap_tensorflow
File "D:\Programs\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 21, in <module>
_pywrap_tensorflow = swig_import_helper()
File "D:\Programs\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow')
File "D:\Programs\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow'
Error importing tensorflow. Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.
我確保已安裝Visual C ++ x64 2015 Redist。 還嘗試了很多重新安裝,重新啟動,谷歌解決方案等,但是沒有幫助。
嘗試運行此腳本:
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
a = tf.constant(10)
b = tf.constant(32)
print(sess.run(a + b))
你能給點建議嗎?
非常感謝! 阿耳emi彌
該錯誤消息很清楚,您需要在其目錄之外初始化TensorFlow。 如果這不是您的問題,請檢查系統中是否已安裝MSVCP140.dll
(請參閱Windows上的Pip安裝下的“ 注意 ”),以確保正確安裝了Cuda和cuDNN並將它們的目錄設置在%PATH%
。
使用更新TensorFlow
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.1-cp35-cp35m-win_amd64.whl
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.