【发布时间】:2020-09-21 22:24:02
【问题描述】:
我正在尝试为 Windows 10 设置第一次安装了 Keras 和 Tensorflow 的 R 环境。 此错误显示在 RStudio 中,但我也尝试以其他方式从 Anaconda 提示符执行此操作,即使没有错误,我也无法正确导入 Tensorflow。 在 RStudio 中:
> library(keras)
> install_keras(method = "conda", tensorflow = "gpu")
> Error: Installing Python packages into a virtualenv is not supported on Windows
在“conda install -c conda-forge tensorflow”和“pip install --upgrade tensorflow-gpu”之后的 Anaconda 提示符中:
(base) PS C:\Users\userx> conda activate renv
(renv) PS C:\Users\userx> python
Python 3.7.1 (default, Oct 28 2018, 08:39:03) [MSC v.1912 64 bit
(AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more
information.
import tensorflow as tf Traceback (most recent call last):
File
"A:\Programy\tools\anaconda3\envs\renv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File
"A:\Programy\tools\anaconda3\envs\renv\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper() File
"A:\Programy\tools\anaconda3\envs\renv\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 "A:\Programy\tools\anaconda3\envs\renv\lib\imp.py", line 242, in
load_module
return load_dynamic(name, filename, file)
File "A:\Programy\tools\anaconda3\envs\renv\lib\imp.py", line 342, in
load_dynamic
return _load(spec)
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 "<stdin>", line 1, in <module>
File
"A:\Programy\tools\anaconda3\envs\renv\lib\site-packages\tensorflow\__init__.py",
line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint:
disable=unused-import
File
"A:\Programy\tools\anaconda3\envs\renv\lib\site-packages\tensorflow\python\__init__.py",
line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File
"A:\Programy\tools\anaconda3\envs\renv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File
"A:\Programy\tools\anaconda3\envs\renv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File
"A:\Programy\tools\anaconda3\envs\renv\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper() File
"A:\Programy\tools\anaconda3\envs\renv\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 "A:\Programy\tools\anaconda3\envs\renv\lib\imp.py", line 242, in
load_module
return load_dynamic(name, filename, file)
File "A:\Programy\tools\anaconda3\envs\renv\lib\imp.py", line 342, in
load_dynamic
return _load(spec)
ImportError: DLL load failed: A dynamic link library (DLL)
initialization routine failed.
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.
任何建议将不胜感激。
【问题讨论】:
标签: python r tensorflow keras anaconda