【问题标题】:Conda Environment and Jupyter Notebook, Python 3.9.2Conda 环境和 Jupyter Notebook,Python 3.9.2
【发布时间】:2021-05-27 07:11:35
【问题描述】:

我的 Conda 环境没有出现在我的 Jupiter Notebooks 中。我已经查看了所有(优秀的)对话@9​​87654321@,但它似乎不适用于 python 3.9.2。

我尝试了以下方法,但没有成功:

conda install jupyter
conda install ipykernel
conda install nb_conda

然后当我尝试以下conda install nb_conda_kernels 时,我收到以下错误:

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.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: | 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                                                                                                                                      

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - nb_conda_kernels -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0']

Your python: python=3.9

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

如何让我的 conda 环境在 python 3.9.2 的 jupyter 笔记本中显示?谢谢!

【问题讨论】:

    标签: python jupyter-notebook anaconda jupyter conda


    【解决方案1】:

    尝试使用 conda-forge 频道,例如:

    $ conda install -c conda-forge ipykernel
    

    如果这个 conda env 只是一个要添加的内核,你不需要安装 jupyter,如果这是你想做的。

    之后,你需要在 conda env 中运行它:

    $ python -m ipykernel install --user --name vanilla --display-name "Python 3 (vanilla)"
    

    根据自己的喜好替换名称和显示名称。

    【讨论】:

    • 谢谢! python -m ipykernel 行无需执行 conda-forge 部分即可工作。感谢您的帮助。
    • 很高兴知道它有效!我花了一些时间为我自己的服务器解决这个问题,如果您有兴趣,我也可以分享远程 ipykernel 的经验。最准确的信息始终是官方文档,它们涵盖了大多数使用场景。
    • 如果发布速度很快,那就太好了。不过我现在不需要知道,所以如果你输入的时间超过 5 分钟,你可以等到社区里有人问。再次感谢您的帮助!
    猜你喜欢
    • 2021-01-24
    • 2016-09-22
    • 2020-04-03
    • 2017-01-28
    • 2019-06-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多