【发布时间】:2020-07-13 09:59:54
【问题描述】:
我正在尝试在 R 中运行 python 脚本。我有一个 macOS Catalina 10.15.4 并且我继续收到此错误:
"Error in value[[3L]](cond) :
Need to install Anaconda from https://www.anaconda.com/download/.
Error: Unable to find conda binary. Is Anaconda installed?"
我已经下载了python 3.8,也已经下载了anaconda。用尽谷歌搜索后。我正在学习我的 conda 的路径可能是问题所在。谷歌搜索然后建议使用“use_condaenv()”来指定正确的路径,但我仍然收到相同的错误:错误:无法找到 conda 二进制文件。 Anaconda 安装了吗?”
简而言之:如何找到我的二进制 conda 的正确位置?如何准确更正路径?如何解决该错误?
这是我到目前为止运行的语法:
install.packages("reticulate")
library(reticulate)
repl_python()
Python 2.7.16 (/usr/bin/python)
Reticulate 1.13 REPL -- A Python interpreter in R.
reticulate::py_config()
python: /usr/bin/python
libpython: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib
pythonhome: /System/Library/Frameworks/Python.framework/Versions/2.7:/System/Library/Frameworks/Python.framework/Versions/2.7
version: 2.7.16 (default, Feb 29 2020, 01:55:37) [GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc-
numpy: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy
numpy_version: 1.8.0
python versions found:
/usr/bin/python
/usr/bin/python3
/usr/local/bin/python3
use_python("/usr/bin/python3", required = TRUE)
**ERROR: The requested version of Python ('/usr/bin/python3') cannot be used, as another version of
Python ('/usr/bin/python') has already been initialized. Please restart the R session if you need
to attach reticulate to a different version of Python.
Error in use_python("/usr/bin/python3", required = TRUE) :
failed to initialize requested version of Python**
Sys.which("python")
python
"/usr/bin/python"
install.packages("youtubecaption")
library(youtubecaption)
**The downloaded binary packages are in
/var/folders/n2/kl03cmjj04n5msjq8x8mt_yr0000gn/T//RtmpD82WW0/downloaded_packages**
url<-"https://www.youtube.com/watch?v=qATvD6kQ47s&t=339s" #this is just an example url#
caption<-get_caption(url)
**Error in value[[3L]](cond) :
Need to install Anaconda from https://www.anaconda.com/download/.
Error: Unable to find conda binary. Is Anaconda installed?**
【问题讨论】:
-
你安装的是什么版本的 conda? Python 2 还是 Python 3?根据上面的代码,你正在尝试混合使用 python 2 和 3,这肯定是行不通的。
-
我安装了python 3.8。我试图通过输入来指定:use_python("/usr/bin/python3", required = TRUE) 但它不起作用。
标签: python r python-3.x anaconda conda