Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过网状结构在R中安装Python模块时出错_Python_R_Scikit Learn_Reticulate - Fatal编程技术网

通过网状结构在R中安装Python模块时出错

通过网状结构在R中安装Python模块时出错,python,r,scikit-learn,reticulate,Python,R,Scikit Learn,Reticulate,我正在使用R,我想使用我用Python编写的一个函数,该函数需要导入: 来自sklearn.neights.kde导入内核密度 我正在尝试使用以下代码: library(reticulate) py_install("scikit-learn.neighbors.kde") 我已经安装了sklearn,其中包括: py\u安装(“scikit学习”) 也在努力 py_安装(“sklearn.neights.kde”) 不起作用 我收到以下错误/日志: Solving env

我正在使用R,我想使用我用Python编写的一个函数,该函数需要导入:

来自sklearn.neights.kde导入内核密度

我正在尝试使用以下代码:

library(reticulate)
py_install("scikit-learn.neighbors.kde")
我已经安装了sklearn,其中包括:
py\u安装(“scikit学习”)

也在努力
py_安装(“sklearn.neights.kde”)

不起作用

我收到以下错误/日志:

Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - scikit-learn.neighbors.kde

Current channels:

  - https://conda.anaconda.org/conda-forge/win-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.


Error: one or more Python packages failed to install [error code 1]

关于如何解决这个问题有什么建议吗?

模块是
KernelDensity
而不是
kde
。如果安装了sklearn,则以下功能应能正常工作:

library(reticulate)
sklearn = import("sklearn")
kde = sklearn$neighbors$KernelDensity

kde
<class 'sklearn.neighbors._kde.KernelDensity'>

X = matrix(rnorm(20),10,1)

kde = kde(kernel="gaussian")$fit(X)
kde$score_samples(X)

[1] -1.479458 -1.603451 -1.338018 -1.465263 -1.655933 -1.463628 -1.340137
 [8] -1.856085 -1.374666 -1.478621
库(网状)
sklearn=导入(“sklearn”)
kde=sklearn$neights$KernelDensity
kde
X=矩阵(rnorm(20),10,1)
kde=kde(kernel=“gaussian”)$fit(X)
kde$score_样本(X)
[1] -1.479458 -1.603451 -1.338018 -1.465263 -1.655933 -1.463628 -1.340137
[8] -1.856085 -1.374666 -1.478621