我正在尝试按照网站中的官方说明在RStudio上安装TensorFlow(适用于Windows10)https://tensorflow.rstudio.com/installation/
以及在 TensorFlow 官方网站中找到的必备条件 https://www.tensorflow.org/install?hl=en
我发现这仍然是一个未解决的问题,因为没有人能够真正帮助解决之前的问题,例如(R,TensorFlow,Anaconda在Windows上安装)
所以我在 youtube 上关注了很多视频并阅读了很多内容,但仍然一无所获。当我跑步时:
library(remotes)
remotes::install_github("rstudio/tensorflow")
library(tensorflow)
install_tensorflow()
tf_config()
Installation of TensorFlow not found.
Python environments searched for 'tensorflow' package:
C:\Users\Simone\anaconda3\envs\r-reticulate\python.exe
C:\Users\Simone\anaconda3\python.exe
You can install TensorFlow using the install_tensorflow() function.
我在尝试了官方页面建议的方法后尝试了这个
install.packages("tensorflow")
library(tensorflow)
install_tensorflow()
library(tensorflow)
tf$constant("Hellow Tensorflow")
但还是一样。我认为这是一个 PATH 问题,但我不知道如何解决。 考虑一下当我跑步时:
py_config() #then i get this
python: C:/Users/Simone/anaconda3/envs/r-reticulate/python.exe
libpython: C:/Users/Simone/anaconda3/envs/r-reticulate/python36.dll
pythonhome: C:/Users/Simone/anaconda3/envs/r-reticulate
version: 3.6.12 |Anaconda, Inc.| (default, Sep 9 2020, 00:29:25) [MSC v.1916 64 bit (AMD64)]
Architecture: 64bit
numpy: C:/Users/Simone/anaconda3/envs/r-reticulate/Lib/site-packages/numpy
numpy_version: 1.19.4
tensorflow: C:\Users\Simone\ANACON~2\envs\R-RETI~1\lib\site-packages\tensorflow\__init__.p
python versions found:
C:/Users/Simone/anaconda3/envs/r-reticulate/python.exe
C:/Users/Simone/anaconda3/python.exe
TensorFlow似乎安装在这个PATH C:\Users\Simone\ANACON~2 nvs\R-RETI~1\lib\site-packages ensorflow_init_.p 但手动检查这个PATH 没有出现。好像 python 安装在一个路径中,而 tensorflow 安装在另一个路径中
知道如何解决路径问题吗?
谢谢!
编辑1: 我还注意到来自
install_tensorflow()
的警告消息
WARNING: The script tensorboard.exe is installed in 'C:\Users\Simo\ANACON~2\envs\R-RETI~1\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
这就是我应该解决的问题,但不知道如何
我在Rstudio中安装tensorflow时遇到了同样的问题,但我找到了一种方法来避免它,方法是在新的anaconda环境中安装tensorflow,然后激活Rstudio中的环境。它可以在我的电脑上运行(win 11,R4.2.1)。
安装anaconda
创建一个名为 tf-gpu 的新张量流环境,打开 anaconda 提示符并运行:
conda 创建-n tf-gpu 张量流-gpu
conda激活tf-gpu
您可以通过以下方式检查 anaconda 提示符中的环境:
conda env list
打开 Rstudio 并运行:
库(“张量流”)
use_condaenv(“tf-gpu”,必需= TRUE)
tf$constant(“你好,张量流!”)
这是大学里的愚蠢的SOPHOS杀毒软件!之后我从电脑上删除了防病毒软件,就没有任何问题了