【问题标题】:How to update Python version in r-reticulate for TensorFlow under R如何在 R 下为 TensorFlow 更新 r-reticulate 中的 Python 版本
【发布时间】:2020-12-17 22:00:12
【问题描述】:

我在 R 下安装了 TensorFlow 2.2.0、Keras 2.3.0 和 Reticulate 1.16。

但我在使用 TensorFlow 时仍然出现此错误:错误:未找到 TensorFlow 的安装。我相信它来自随 TensorFlow 一起安装的 Python 3.6。如何在 r-reticulate 中更新 Python 版本?

> library(tensorflow)
> library(reticulate)
> use_condaenv("r-reticulate", required = TRUE)
> py_discover_config("tensorflow")
python:         C:/Users/Mezeix/AppData/Local/r-miniconda/envs/r-reticulate/python.exe
libpython:      C:/Users/Mezeix/AppData/Local/r-miniconda/envs/r-reticulate/python36.dll
pythonhome:     C:/Users/Mezeix/AppData/Local/r-miniconda/envs/r-reticulate
version:        3.6.10 |Anaconda, Inc.| (default, May  7 2020, 19:46:08) [MSC v.1916 64 bit (AMD64)]
Architecture:   64bit
numpy:          C:/Users/Mezeix/AppData/Local/r-miniconda/envs/r-reticulate/Lib/site-packages/numpy
numpy_version:  1.19.1
tensorflow:     C:\Users\Mezeix\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\tensorflow\__init__.p

> tf$constant("Hellow Tensorflow")
Error: Installation of TensorFlow not found.

Python environments searched for 'tensorflow' package:
 C:\Users\Mezeix\AppData\Local\r-miniconda\envs\r-reticulate\python.exe

You can install TensorFlow using the install_tensorflow() function.

【问题讨论】:

    标签: python r tensorflow keras


    【解决方案1】:
    install.packages("tensorflow")#install the tensorflow R package from GitHub 
    
    library(tensorflow)
    install_tensorflow()#missed step
    
    library(tensorflow)
    tf$constant("Hellow Tensorflow")
    

    欲了解更多详情,请访问 - https://tensorflow.rstudio.com/installation/

    【讨论】:

      【解决方案2】:

      试试:

      library(tensorflow)
      
      install_tensorflow()
      

      然后:

      library(tensorflow)
      
      tf$constant("Hellow Tensorflow")
      

      工作?

      【讨论】:

      • 没有。我是否需要通过提供环境名称来安装 tensorflow?如:install_tensorflow(方法=“conda”,conda=“auto”,version=“2.2.0”,envname=“r-reticulate”,extra_packages=NULL,restart_session=TRUE,conda_python_version=“3.8”)
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-09
      • 2021-08-27
      • 1970-01-01
      • 2021-10-07
      • 1970-01-01
      • 2020-05-08
      相关资源
      最近更新 更多