Conda 4.10 与 python 3.10 不兼容。
这个问题与R无关,也许你的代码没有任何问题。以下 SO 问题也出现了相同类型的问题:
- PyTorch 安装要求 python=3.1 。安装的Python版本:3.10.0 https://stackoverflow.com/questions/70154524/pytorch-installation-asks-for-python-3-1-python-version-installed-3-10-0
- 尝试在 R 上安装 Earth Engine; python=3.1 不可用 https://stackoverflow.com/questions/69782612/trying-to-install-earth-engine-on-r-python-3-1-not-available
- 为什么我无法使用 pip 或 miniconda 安装 matplotlib 或 pandas? https://stackoverflow.com/questions/69731871/why-cant-i-install-matplotlib-or-pandas-with-pip-or-miniconda/70297064#70297064
解决方案
如果你需要 python 3.10+
如果您需要 python 3.10 或更高版本,则必须有 conda 4.11 或更高版本。安装所需的conda版本,或切换到基础环境并更新康达 https://docs.anaconda.com/anaconda/install/update-version/ using conda update conda
。就像是:
conda activate base
conda update conda
conda create --name r-reticulate python=3.10 pandas numpy scipy matplotlib scikit-learn
conda activate r-reticulate
您可能需要向您的 conda 添加非默认通道,因为我得到了UnsatisfiableError
使用它。例如,通过使用 conda-forge 通道,我没有收到任何错误(但这可能会安装比通常更新的软件包):
conda create --name r-reticulate -c conda-forge python=3.10 pandas numpy scipy matplotlib scikit-learn
如果你想保留旧的康达
使用 python 3.9 或更早版本从基础安装另一个环境
conda activate base
conda create --name r-reticulate python=3.9 pandas numpy scipy matplotlib sklearn
conda activate r-reticulate
其他症状
创建并激活 python 3.10 环境后,您基本上无法安装任何东西。你甚至无法安装 conda-build:
conda install conda-build -y
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
ResolvePackageNotFound:
- python=3.1
Conda 4.10 包含 python 3.9,conda 4.11 包含 python 3.10 https://docs.conda.io/projects/conda/en/latest/release-notes.html,所以你的基础环境应该与其中的python版本兼容。
复制?
如果您认为您的问题重复,请检查如何改进它 https://meta.stackexchange.com/questions/10841/how-should-duplicate-questions-be-handled.
这个答案符合meta https://meta.stackexchange.com/questions/104227/is-it-acceptable-to-add-a-duplicate-answer-to-several-questions。我相信这是一个例子应该接受完全相同的答案 http://meta.stackexchange.com/q/267318/178179,但我也定制了问题的答案。