更改python RStudi的默认版本

2024-04-25 21:35:34 发布

您现在位置:Python中文网/ 问答频道 /正文

在RStudio中,使用library('PythonInR'),然后使用PythonInR::pyConnect() 它显示了名为/System/Library/Frameworks的python的位置/Python.framework/Versions/2.7/lib/Python2.7, 但是我的mac电脑里没有这样的软件包,因为我已经把它删除了。
我只想知道在使用pythonin时如何更改RStudio的默认python路径?在


Tags: 路径macliblibraryframeworkversionssystem电脑
1条回答
网友
1楼 · 发布于 2024-04-25 21:35:34

^{}的参数允许您以多种方式指定要与R/R Studio一起使用的python环境-

library('PythonInR')
pyConnect(pythonExePath = "C:/ProgramData/Anaconda3/python.exe", dllDir = "C:/ProgramData/Anaconda3", pythonHome = "C:/ProgramData/Anaconda3")`

来自文档

Arguments

pythonExePath a character containing the path to "python.exe" (e.g. "C:\Python27\python.exe")

dllDir an optional character giving the path to the dll file. Since the dll file is normally in a system folder or in the same location as python.exe, this parameter is almost never needed!

pythonHome an optional character giving the path to PYTHONHOME. On Windows by default PYTHONHOME is the folder where python.exe is located, therefore this parameter is normally not needed.

dllName a character giving the name of the dll file (e.g.d "python27.dll"). majorVersion an integer giving the major Python version (e.g. 2 or 3).

pyArch a character giving the Python architecture, i.e. "32bit" or "64bit". useCstdout a logical indicating if the C stdout should be used or the stout should be redirected at a Python level.

TL;DR

使用pythonExePath指定pythonexe位置并尝试。如果仍然无法工作,请尝试后续参数

相关问题 更多 >