R,TensorFlow,Anaconda在Windows上安装 [英] R, TensorFlow, Anaconda Install on Windows
问题描述
我正在尝试为R安装tensorflow.为此,我在操作系统上安装了最新版本的Anaconda(4.3.1),并按照以下说明安装了所有内容:
I'm tryiing to install tensorflow for R. For this purpose I installed the latest version of Anaconda (4.3.1) to my OS and installed everything as described in:
https://rstudio.github.io/tensorflow/installation.html
要开始使用,请按如下所示从GitHub安装tensorflow R软件包:
To get started, install the tensorflow R package from GitHub as follows:
devtools::install_github("rstudio/tensorflow")
然后,使用install_tensorflow()函数安装TensorFlow:
Then, use the install_tensorflow() function to install TensorFlow:
library(tensorflow)
install_tensorflow()
此过程的结果是一个文件夹〜\ AppData \ Local \ conda \ conda \ envs \ r-tensorflow ,Anaconda应该将该文件夹用作环境.当前版本的Anaconda无法识别此环境.
The result of this process is a folder ~\AppData\Local\conda\conda\envs\r-tensorflow which should be used by Anaconda as an Evironment. This environment is not recognized by the current version of Anaconda.
但是R中的输出是:
错误:未找到Python模块tensorflow.
Error: Python module tensorflow was not found.
检测到的Python配置:
Detected Python configuration:
python: C:\PROGRA~3\ANACON~1\python.exe
libpython: C:/PROGRA~3/ANACON~1/python36.dll
pythonhome: C:\PROGRA~3\ANACON~1
version: 3.6.0 |Anaconda 4.3.1 (64-bit)| (default, Dec 23 2016, 11:57:41) [MSC v.1900 64 bit (AMD64)]
Architecture: 64bit
numpy: C:\PROGRA~3\ANACON~1\lib\site-packages\numpy
numpy_version: 1.11.3
tensorflow: [NOT FOUND]
没有我的猜测:
-
Anaconda 4.3.1确实将文件夹 C:\ ProgramData \ Anaconda3 \ pkgs 用于其软件包,并且根本不使用上面的文件夹.这可能是为什么找不到tensorflow的原因.
Anaconda 4.3.1 does use the folder C:\ProgramData\Anaconda3\pkgs for its packages and does not use the folder above at all. This might be the cause why tensorflow is not found.
https://rstudio.github.io/tensorflow/installation.html 与最新版本的anaconda不匹配.
The described process from https://rstudio.github.io/tensorflow/installation.html does not match the latest version of anaconda.
您能告诉我如何使tensorflow与最新版本的R,tensorflow和Anaconda一起使用吗?
Can you show me how to get tensorflow to work with the latest versions of R, tensorflow and Anaconda?
我试图通过
conda install -c conda-forge r-tensorflow
R加载的环境无法识别它.我可以直接在R中更改tensorflow的环境吗?
It is not recognized by the environment loaded in R. Can I change the environment of tensorflow directly in R?
推荐答案
好,我发现在使用tensorflow和Anaconda的情况下,我需要强制Anaconda使用Tensorflow环境,然后才能使用它.到目前为止,它尚未包含在R tensorflow库中,必须由网状库进行设置:
Ok, I found out that in the case of tensorflow and Anaconda used I need to force Anaconda to use the Tensorflow environment before i can use it. This is not included in the R tensorflow library so far and must be set by the reticulate library:
#set anaconda to tensor flow environment
library(reticulate)
use_condaenv("r-tensorflow")
#Alternative
use_condaenv(condaenv = "r-tensorflow", conda = "YOUR_ANACONDA_PATH")
我在这里发布了一个问题:
I posted an issue here:
https://github.com/rstudio/tensorflow/issues/119
这篇关于R,TensorFlow,Anaconda在Windows上安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!