|
Anaconda 再重新安裝(不用虛擬環境),安裝時記得如 p1-10 核選 Add Anaconda to the system PATH enviroment variable 加入環境變數。(Python 的版本是 3.7.7)
然後以 pip install tensorflow 安裝 tensorflow,目前最新的版本是 2.1.0 再以 pip install keras 安裝 keras,目前最新的版本是 2.3.1
Spyder測試 TensorFlow和Keras 1.71
程式碼 import tensorflow as tf print(tf.__version__) import keras print(keras.__version__)
出現以下一樣錯誤:
Python 3.6.10 |Anaconda, Inc.| (default, May 7 2020, 19:46:08) [MSC v.1916 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information.
IPython 7.13.0 -- An enhanced Interactive Python.
runfile('C:/Users/USER/.spyder-py3/temp.py', wdir='C:/Users/USER/.spyder-py3') Traceback (most recent call last):
File "C:\Users\USER\.conda\envs\tensorflowenv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\USER\.conda\envs\tensorflowenv\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\USER\.conda\envs\tensorflowenv\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\.conda\envs\tensorflowenv\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file)
File "C:\Users\USER\.conda\envs\tensorflowenv\lib\imp.py", line 343, in load_dynamic return _load(spec)
ImportError: DLL load failed: 動態連結程式庫 (DLL) 初始化例行程序失敗。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\USER\.spyder-py3\temp.py", line 1, in <module> import tensorflow as tf
File "C:\Users\USER\.conda\envs\tensorflowenv\lib\site-packages\tensorflow\__init__.py", line 41, in <module> from tensorflow.python.tools import module_util as _module_util
File "C:\Users\USER\.conda\envs\tensorflowenv\lib\site-packages\tensorflow\python\__init__.py", line 50, in <module> from tensorflow.python import pywrap_tensorflow
File "C:\Users\USER\.conda\envs\tensorflowenv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in <module> raise ImportError(msg)
ImportError: Traceback (most recent call last): File "C:\Users\USER\.conda\envs\tensorflowenv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\USER\.conda\envs\tensorflowenv\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\USER\.conda\envs\tensorflowenv\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\.conda\envs\tensorflowenv\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Users\USER\.conda\envs\tensorflowenv\lib\imp.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed: 動態連結程式庫 (DLL) 初始化例行程序失敗。
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace above this error message when asking for help. |