![](/img/trans.png)
[英]Trying to run Python using Reticulate giving a module not found error, but it is installed
[英]Reticulate python not recognizing local python : Error: Python shared library not found, Python bindings not loaded
I have downloaded the python tar and extracted locally in linux ubuntu /app folder, When I configure this python using the R reticulate I get the error message " Error: Python shared library not found, Python bindings not loaded. Use reticulate::install_miniconda( ) 如果你想安裝 Miniconda Python 環境。”
這是我在 R 上運行的代碼
> Python_Script_version<<-paste0("/app/bin/Python-3.9.1")
> Sys.setenv(RETICULATE_PYTHON= Python_Script_version)
> reticulate ::use_python(Python_Script_version, required = TRUE)
> Sys.which("python")
python
"/app/bin/Python-3.9.1/python"
> library(reticulate)
> py_config()
Error in py_config() : could not find function "py_config"
> reticulate::py_config()
Error: Python shared library not found, Python bindings not loaded.
Use reticulate::install_miniconda() if you'd like to install a Miniconda Python environment.
感謝您的時間和回復。
這對我有用!
> apt-get update && apt-get upgrade -y
> apt-get install -y r-base python3 python3-dev python3-pip python3-venv
> R
> install.packages("reticulate")
> library(reticulate)
> reticulate::py_discover_config()
python: /usr/bin/python3
libpython: /usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so
pythonhome: /usr:/usr
version: 3.6.8 (default, Oct 7 2019, 12:59:55) [GCC 8.3.0]
numpy: [NOT FOUND]
> py_install("pandas") # install another python package as a test
> pandas <- import("pandas")
您需要將 python 文件解壓縮到與 python 和 r 腳本相同的目錄中
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.