将r包导入jupyter笔记本(使用rpy2)的最佳方式是什么?

将r包导入jupyter笔记本(使用rpy2)的最佳方式是什么?,r,python-3.x,jupyter-notebook,rpy2,R,Python 3.x,Jupyter Notebook,Rpy2,我正试图使用rpy2将一个r包(标题为“afex”)导入jupyter笔记本,以便于使用python。然而,我得到了“Selection:”语句,后面是空行。我试着把各种镜像链接插入空白行,但是没有任何帮助。我很想知道是否有人遇到过这种情况,并且能够提供帮助 代码见下文: #Importing key libraries. import numpy as np import pandas as pd import seaborn as sns import scipy.stats as sta

我正试图使用rpy2将一个r包(标题为“afex”)导入jupyter笔记本,以便于使用python。然而,我得到了“Selection:”语句,后面是空行。我试着把各种镜像链接插入空白行,但是没有任何帮助。我很想知道是否有人遇到过这种情况,并且能够提供帮助

代码见下文:

#Importing key libraries.

import numpy as np
import pandas as pd
import seaborn as sns
import scipy.stats as stats
import matplotlib.lines as mlines
from matplotlib import pyplot as plt
from statsmodels.formula.api import ols

# Download rpy2 package
# Note: The r-modules require Rpy2 to be installed, which should first be done using 
# "conda install -c conda-forge rpy2"
# using Jupyter lab within the conda navigator (terminal within there).
%load_ext rpy2.ipython
%load_ext rmagic

# Import the necessary objects from rpy2 and acrivate conversion for dataframe columns
from rpy2.robjects import *
pandas2ri.activate()

# Import the r library for anovas
#import afex
%R install.packages("afex")
以下是问题(在执行上述命令后得到的输出): 选择:


该问题的屏幕截图链接也附在附件中。

默认情况下,R将以交互方式要求用户选择从中下载包的镜像,并且由于某些原因,镜像列表不会显示在您的系统上(此时不支持使用Windows?rpy2)

请参阅文档以选择镜像并从Python安装:


非常感谢您!!