我希望这里的某个人可能能够解决我遇到的问题...我已经尝试将tensorflow安装到RStudio中(使用以下说明:https://tensorflow.rstudio.com/installation/)已经有几个星期了但是不断遇到错误,我无法使用本网站上其他类似问题的其他用户的建议来解决。实际上,这通常会导致更多错误。我在Windows 10上运行并具有以下版本:R 4.0.0,RStudio 1.3.959,Python 3.8 + Anaconda。我 R和RStudio的新手,还没有使用过Python,但是我觉得问题可能与路径有关...
这是从头到尾的整个过程:
> install.packages("tensorflow")
Installing package into ‘C:/Users/Jodie/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/4.0/tensorflow_2.2.0.zip'
Content type 'application/zip' length 143984 bytes (140 KB)
downloaded 140 KB
package ‘tensorflow’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Jodie\AppData\Local\Temp\RtmpcnUyxX\downloaded_packages
> library(tensorflow)
> install_tensorflow()
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done
# All requested packages already installed.
Requirement already up-to-date: tensorflow==2.2.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (2.2.0)
Requirement already satisfied, skipping upgrade: h5py<2.11.0,>=2.10.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (2.10.0)
Requirement already satisfied, skipping upgrade: six>=1.12.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.15.0)
Requirement already satisfied, skipping upgrade: astunparse==1.6.3 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.6.3)
Requirement already satisfied, skipping upgrade: numpy<2.0,>=1.16.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.18.1)
Requirement already satisfied, skipping upgrade: opt-einsum>=2.3.2 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (3.2.1)
Requirement already satisfied, skipping upgrade: gast==0.3.3 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (0.3.3)
Requirement already satisfied, skipping upgrade: protobuf>=3.8.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (3.12.2)
Requirement already satisfied, skipping upgrade: grpcio>=1.8.6 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.29.0)
Requirement already satisfied, skipping upgrade: wheel>=0.26; python_version >= "3" in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (0.34.2)
Requirement already satisfied, skipping upgrade: absl-py>=0.7.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (0.9.0)
Requirement already satisfied, skipping upgrade: keras-preprocessing>=1.1.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.1.2)
Requirement already satisfied, skipping upgrade: tensorflow-estimator<2.3.0,>=2.2.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (2.2.0)
Requirement already satisfied, skipping upgrade: termcolor>=1.1.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.1.0)
Requirement already satisfied, skipping upgrade: wrapt>=1.11.1 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.12.1)
Requirement already satisfied, skipping upgrade: google-pasta>=0.1.8 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (0.2.0)
Requirement already satisfied, skipping upgrade: tensorboard<2.3.0,>=2.2.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (2.2.2)
Requirement already satisfied, skipping upgrade: scipy==1.4.1; python_version >= "3" in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.4.1)
Requirement already satisfied, skipping upgrade: setuptools in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from protobuf>=3.8.0->tensorflow==2.2.0) (47.1.1.post20200604)
Requirement already satisfied, skipping upgrade: werkzeug>=0.11.15 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.0.1)
Requirement already satisfied, skipping upgrade: google-auth-oauthlib<0.5,>=0.4.1 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (0.4.1)
Requirement already satisfied, skipping upgrade: tensorboard-plugin-wit>=1.6.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.6.0.post3)
Requirement already satisfied, skipping upgrade: requests<3,>=2.21.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (2.23.0)
Requirement already satisfied, skipping upgrade: google-auth<2,>=1.6.3 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.16.1)
Requirement already satisfied, skipping upgrade: markdown>=2.6.8 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.2.2)
Requirement already satisfied, skipping upgrade: requests-oauthlib>=0.7.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.3.0)
Requirement already satisfied, skipping upgrade: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from requests<3,>=2.21.0->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.25.9)
Requirement already satisfied, skipping upgrade: idna<3,>=2.5 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from requests<3,>=2.21.0->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (2.9)
Requirement already satisfied, skipping upgrade: chardet<4,>=3.0.2 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from requests<3,>=2.21.0->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.0.4)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from requests<3,>=2.21.0->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (2020.4.5.1)
Requirement already satisfied, skipping upgrade: pyasn1-modules>=0.2.1 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (0.2.8)
Requirement already satisfied, skipping upgrade: rsa<4.1,>=3.1.4 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (4.0)
Requirement already satisfied, skipping upgrade: cachetools<5.0,>=2.0.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (4.1.0)
Requirement already satisfied, skipping upgrade: importlib-metadata; python_version < "3.8" in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from markdown>=2.6.8->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.6.1)
Requirement already satisfied, skipping upgrade: oauthlib>=3.0.0 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.1.0)
Requirement already satisfied, skipping upgrade: pyasn1<0.5.0,>=0.4.6 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (0.4.8)
Requirement already satisfied, skipping upgrade: zipp>=0.5 in c:\users\jodie\appdata\local\r-mini~1\envs\r-reti~1\lib\site-packages (from importlib-metadata; python_version < "3.8"->markdown>=2.6.8->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.1.0)
Installation complete.
Restarting R session...
> library(tensorflow)
> tf$constant("Hellow Tensorflow")
Error: Installation of TensorFlow not found.
Python environments searched for 'tensorflow' package:
C:\Users\Jodie\AppData\Local\r-miniconda\envs\r-reticulate\python.exe
You can install TensorFlow using the install_tensorflow() function.
R是否在错误的位置寻找张量流,而我只需要更改路径?如果我使用此处所述的网状结构:https://github.com/rstudio/tensorflow/issues/144,则以下消息会导致相同的错误:
In addition: Warning message:
Python 'C:\Users\Jodie\AppData\Local\r-miniconda\envs\r-tensorflow\python.exe' was requested but 'C:/Users/Jodie/AppData/Local/r-miniconda/envs/r-reticulate/python.exe' was loaded instead (see reticulate::py_config() for more information)
在我的MSc研究课程中,我希望使用tensorflow和keras通过图像对豹海豹的身体状况进行分类,因此,如果有人有任何建议,那将非常有帮助,谢谢!