在R中找不到python和conda

2020-07-14  本文已影响0人  laa_50f8

安装的R包需要使用python搭建的包,报错如下:

/> scAI_outs <- identifyClusters(scAI_outs, resolution = 1)
Error in runLeiden(SNN = snn, resolution = resolution, partition_type = partition.type, :
Cannot find Leiden algorithm, please install through pip (e.g. pip install leidenalg).

因此想用reticulate包在R中调用python去安装,结果找不到conda.exe??明明电脑里有的
网上一搜也全都是成功使用reticulate的例子,没什么失败的。。

/> py_available()
[1] FALSE
/> repl_python()
Error: Specified conda binary 'C:/PROGRA~3 /ANACON~1/Scripts/conda.exe' does not exist.

我一开始以为是自己电脑conda没装好,然后试了试用来装软件是正常的,安装的jupyter notebook都跑的好好的
就在要放弃的时候,想了想自己都是百度找的,经验可能不全,去google了一下,能搜到很多类似的问题,参考了https://github.com/rstudio/keras/issues/256

/>Sys.setenv(RETICULATE_PYTHON="C:\\ProgramData\\Miniconda3\\python.exe")

指定路径后再测试一下,果然好了呢!

/>repl_python()
Python 3.7.3 (C:/ProgramData/Miniconda3/python.exe)
Reticulate 1.16 REPL -- A Python interpreter in R.
/> py_available()
[1] TRUE

开心!

上一篇下一篇

猜你喜欢

热点阅读