无法使 `pandas` 模块在 `reticulate` 中可用
Can't make `pandas` module available in `reticulate`
我试图在 R 中使用 keras
,当我试图调用 flow_images_from_dataframe()
:
时出现错误
Error in flow_images_from_dataframe() :
Pandas (python module) must be installed in the same environment as Keras.Install it using reticulate::virtualenv_install("pandas", envname = "r-tensorflow") or reticulate::conda_install("pandas", envname = "r-tensorflow") depending on the kind of environment you are using.
我尝试了以下方法:
reticulate::py_module_available("pandas")
# FALSE.
# checking that environment is there:
reticulate::virtualenv_list()
# "r-reticulate" "r-tensorflow"
# activate the environment:
use_virtualenv('r-tensorflow')
reticulate::virtualenv_install("pandas", envname = "r-tensorflow")
# ...
# ...
# Installing collected packages: pandas
# Successfully installed pandas-1.1.5
# Trying again:
py_module_available("pandas")
# FALSE
# The issue is specific to pandas, other modules are fine:
reticulate::py_module_available('scipy')
# TRUE
我仍然不明白那里的问题是什么以及为什么 virtualenv_install()
没有完成这项工作,但对我有帮助的解决方案很简单
py_install("pandas")
我试图在 R 中使用 keras
,当我试图调用 flow_images_from_dataframe()
:
Error in flow_images_from_dataframe() :
Pandas (python module) must be installed in the same environment as Keras.Install it using reticulate::virtualenv_install("pandas", envname = "r-tensorflow") or reticulate::conda_install("pandas", envname = "r-tensorflow") depending on the kind of environment you are using.
我尝试了以下方法:
reticulate::py_module_available("pandas")
# FALSE.
# checking that environment is there:
reticulate::virtualenv_list()
# "r-reticulate" "r-tensorflow"
# activate the environment:
use_virtualenv('r-tensorflow')
reticulate::virtualenv_install("pandas", envname = "r-tensorflow")
# ...
# ...
# Installing collected packages: pandas
# Successfully installed pandas-1.1.5
# Trying again:
py_module_available("pandas")
# FALSE
# The issue is specific to pandas, other modules are fine:
reticulate::py_module_available('scipy')
# TRUE
我仍然不明白那里的问题是什么以及为什么 virtualenv_install()
没有完成这项工作,但对我有帮助的解决方案很简单
py_install("pandas")