简体   繁体   English

尝试使用 Reticulate 运行 Python,出现未找到模块的错误,但已安装

[英]Trying to run Python using Reticulate giving a module not found error, but it is installed

I am trying to source data from a python script to use in R. I am using Articulate and PyCharm.我正在尝试从 Python 脚本中获取数据以在 R 中使用。我正在使用 Articulate 和 PyCharm。

The script imports the module GetOldTweets3 and runs fine on its own, but when I try to run it using Articulate, I get Exception: ModuleNotFoundError: No module named 'GetOldTweets3'该脚本导入模块 GetOldTweets3 并自行运行良好,但是当我尝试使用 Articulate 运行它时,出现Exception: ModuleNotFoundError: No module named 'GetOldTweets3'

py_config() gives me: py_config()给了我:

python:         C:/Users/<username>/AppData/Local/r-miniconda/envs/r-reticulate/python.exe
libpython:      C:/Users/<username>/AppData/Local/r-miniconda/envs/r-reticulate/python36.dll
pythonhome:     C:/Users/<username>/AppData/Local/r-miniconda/envs/r-reticulate
version:        3.6.10 |Anaconda, Inc.| (default, Mar 23 2020, 17:58:33) [MSC v.1916 64 bit (AMD64)]
Architecture:   64bit
numpy:          C:/Users/<username>/AppData/Local/r-miniconda/envs/r-reticulate/Lib/site-packages/numpy
numpy_version:  1.18.1

Running conda list in a terminal shows it there (in the pypi channel).在终端中运行conda list显示它(在pypi频道中)。

I am calling the python script using source_python() .我正在使用source_python()调用 python 脚本。

Make sure you activate the conda virtual environment确保激活 conda 虚拟环境

It looks like numpy is installed in your personal r-retuculate python virtual environment.看起来 numpy 已安装在您的个人 r-retuculate python 虚拟环境中。 Make sure you activate the virtual environment associated with your installed python packages.确保激活与安装的 python 包关联的虚拟环境。

library(reticulate)
use_virtualenv("r-reticulate")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 安装的模块上出现“找不到Python模块”错误 - “Python module not found” error on installed module 使用 Reticulate 运行 Python 脚本和 Arguments - Using Reticulate to Run a Python Script with Arguments 安装了python pyserial模块,但出现错误没有模块名称序列 - Python pyserial module installed but giving error No module name serial 尝试导入已安装接收错误的 python 模块 - Trying to import a python module that is installed receiving error 我已经在 spyder 上安装了“apiclient”,但是当我在 Python 中运行该程序时,为什么会出现错误“找不到模块错误” - I have installed "apiclient" to the spyder but why it gives the error "Module Not Found Error" when i run the program in Python 找不到已安装的python模块 - installed python module not found 在MAC上获取crontab以运行anaconda安装的python脚本(未找到模块) - Getting crontab on MAC to run anaconda installed python script (module not found) 通过网状在 R 中安装 Python 模块时出错 - Error while installing Python module in R via reticulate 尝试通过网状 package 在 R 中使用 Python Gekko 时出错 - Error when trying to use Python Gekko in R via reticulate package 在macOS上找不到已安装的Python模块 - Installed Python Module Not Found on macOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM