簡體   English   中英

在 R 中安裝 Keras/Tensorflow

[英]Installing Keras/Tensorflow in R

我正在嘗試按照此處提到的順序安裝 Keras/Tensorflow

在我使用 install.packages("tensorflow") 安裝“tensorflow”之前一切正常,但是當我嘗試“install_tensorflow()”函數調用時,它拋出了以下錯誤

TypeError: LoadLibrary() argument 1 must be str, not None
Error: Error 1 occurred creating conda environment r-tensorflow

我嘗試卸載 Anaconda 並重新安裝它的干凈版本,然后我嘗試了上述步驟,仍然出現相同的錯誤。 我嘗試按照其他帖子安裝網狀包,但即使這樣也會引發錯誤

In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Users\<user>\Documents\R\win-library\3.6\00LOCK\reticulate\libs\x64\reticulate.dll to C:\Users\<user>\Documents\R\win-library\3.6\reticulate\libs\x64\reticulate.dll: Permission denied

我不確定我在這里做錯了什么。 有沒有我遺漏的步驟? 我也使用過 RGui、RStudio、Visual Studio 甚至 R cmd shell。 到處都是同樣的問題。

您是否嘗試過從 anaconda 環境所在的目錄初始化 R?

我檢查了所有的建議。 他們都沒有工作。 這在 Windows 10 上對我有用

1- 如果您已經使用以下方法安裝,請打開 rstudio 並卸載這些軟件包:

uninstall.packages(c("keras", "tensorflow","tfruns"))

2- 從您的計算機卸載 rtools 如果存在

3- 從https://www.anaconda.com/products/individual安裝 Anaconda

4- 從https://cran.r-project.org/bin/windows/Rtools/安裝最新版本的 rtools

5- rstudio 如果打開則關閉

6-打開新會話並寫下:

install.packages("reticulate")
install.packages("remotes")
library("reticulate")
remotes::install_github("rstudio/tensorflow")
library(tensorflow)
install_tensorflow(version = "2.0.0b1", method = "conda", envname = "r-reticulate")

remotes::install_github("rstudio/keras", dependencies = TRUE)
library(keras)

7-檢查它們是否有效:

#如果張量流有效

tf$abs(-1)

#如果 keras 有效

mnist <- dataset_mnist()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM