在R中导入python模块
我正在尝试使用该reticulate
软件包在R中导入python模块。该模块可以在这里找到。我克隆了存储库并python
setup.py install
运行成功。如果打开python
shell,则可以导入debot
。但是,当我尝试将其导入RStudio时,出现以下错误:
dbot=import("debot")
Error in py_module_import(module, convert = convert) :
ImportError: No module named debot
我在macOS Sierra版本10.12.6上并通过Anaconda安装了python 3.6。我也尝试过给出python的路径为:
path_to_python <- "/anaconda/bin/python3.6"
use_python(path_to_python)
当我从终端运行python时,我得到:
Python 3.6.1 |Anaconda 4.4.0 (x86_64)| (default, May 11 2017, 13:04:09)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
不确定python的路径是否正确。
好的,做了一些进一步的挖掘,发现它reticulate
仍然指向我的旧版本python
2.7的python路径,这是Macbook的默认路径。当我跑步时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.10 (default, Feb 7 2017, 00:08:15) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]
无论我尝试什么,都无法reticulate
使用该use_python()
功能查看安装模块的正确路径。我确实认为这是一个问题reticulate
。有什么想法我下一步应该做什么?