网状:无法配置python3

我正在使用reticulateR 包并想python3用它进行配置,但无法做到。我尝试了以下代码


library(reticulate)


packageVersion("reticulate")

# [1] ‘1.10.0.9002’


use_python(python = "/usr/bin/python", required = TRUE)


py_config()

# python:         /usr/bin/python

# libpython:      /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so

# pythonhome:     /usr:/usr

# version:        2.7.15rc1 (default, Apr 15 2018, 21:51:34)  [GCC 7.3.0]

# numpy:          /usr/lib/python2.7/dist-packages/numpy

# numpy_version:  1.13.3

#

# NOTE: Python version was forced by use_python function


Sys.which("python3")

# python3 

# "/usr/bin/python3" 


use_python(python = "/usr/bin/python3", required = TRUE)


py_config()

# python:         /usr/bin/python

# libpython:      /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so

# pythonhome:     /usr:/usr

# version:        2.7.15rc1 (default, Apr 15 2018, 21:51:34)  [GCC 7.3.0]

# numpy:          /usr/lib/python2.7/dist-packages/numpy

# numpy_version:  1.13.3

# NOTE: Python version was forced by use_python function

任何提示,请。


桃花长相依
浏览 153回答 1
1回答

慕妹3242003

不要不运行use_python(python = "/usr/bin/python", required = TRUE)在配置成python3. 正如这里所讨论的,一个 R 会话只允许使用一个 Python 解释器。这是我在笔记本电脑上看到的,如果use_python仅配置为python3:library(reticulate)use_python(python = Sys.which("python3"), required = TRUE)py_config()# python:         /usr/local/bin/python3# libpython:      /usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/config-3.5m/libpython3.5.dylib# pythonhome:     /usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5:/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5# version:        3.5.2 (default, Jul 28 2016, 21:28:00)  [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]# numpy:          /usr/local/lib/python3.5/site-packages/numpy# numpy_version:  1.12.0# # NOTE: Python version was forced by use_python function
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python