简体   繁体   English

无法使用 python 3.9 env 运行 Jupyter Notebook

[英]Can't run Jupyter Notebook with python 3.9 env

I'm new to using python and conda (and linux for that matter) and I've had some trouble running a Jupyter notebook through a python 3.9 environment.我是使用 python 和 conda(以及 linux)的新手,我在通过 python 3.9 环境运行 Jupyter 笔记本时遇到了一些问题。 I've noticed that the base 3.8.5 environment works (and allows me to open Jupyter 6.1.4) , but I'm not sure why.我注意到基础 3.8.5 环境有效(并允许我打开 Jupyter 6.1.4),但我不确定为什么。 I've updated anaconda and conda through conda update conda and conda update anaconda and get the same我已经通过conda update condaconda update anacondaconda update anaconda并得到相同的结果

# All requested packages already installed.

In the anaconda-navigator GUI, when I try to use a py39 environment and click install on Jupyter, I notice it tries to install Jupyter version 6.0.3 and I also get this error.在 anaconda-navigator GUI 中,当我尝试使用 py39 环境并单击 Jupyter 上的安装时,我注意到它尝试安装 Jupyter 6.0.3 版,但我也收到此错误。

I've also tried to install pykernel into my env (not sure if it would've done anything to help my issue) in which I get:我还尝试将 pykernel 安装到我的环境中(不确定它是否会帮助我解决问题),我得到:

$conda install ipykernel
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.
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:

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

Your python: python=3.9


     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:
    
      - ipykernel -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0']
    
    Your python: python=3.9

I'm assuming that is why Jupyter was unable to install notebook.我假设这就是 Jupyter 无法安装笔记本的原因。 I'm really new to this stuff so if any more detail is required from me, please let me know.我对这些东西真的很陌生,所以如果需要我提供更多细节,请告诉我。 I don't really understand this issue and can't find anything similar.我真的不明白这个问题,也找不到类似的东西。

You can follow the steps below:您可以按照以下步骤操作:

  1. conda create -n py39 python=3.9
  2. pip3 install --upgrade pip
  3. pip3 install jupyter
  4. Go to anaconda prompt转到 anaconda 提示符
  5. Activate py39激活 py39
  6. Run jupyter-notebook运行 jupyter-notebook
  7. Run after changing path as per your machine : python C:\\ProgramData\\Anaconda3\\envs\\py39\\Scripts\\pywin32_postinstall.py -install根据您的机器更改路径后运行: python C:\\ProgramData\\Anaconda3\\envs\\py39\\Scripts\\pywin32_postinstall.py -install
  8. Run : jupyter-notebook from anaconda prompt从 anaconda 提示符运行:jupyter-notebook
  9. Check version of Python on Jupyter notebook.在 Jupyter 笔记本上检查 Python 的版本。

What I tried, basen on Pushpendra Singh Nathavat's response is:我尝试过的,基于 Pushpendra Singh Nathavat 的回应是:

conda create -n py39 python=3.9 -y 
conda activate py39
pip install jupyter
jupyter notebook

You can check the Python version inside the notebook using:您可以使用以下命令检查笔记本中的 Python 版本:

import sys
sys.version

Yo must write three code in the terminal.您必须在终端中编写三个代码。

  1. conda create -n py39 python=3.9畅达创建-n py39 python=3.9
  2. pip3 install --upgrade pip pip3 install --upgrade pip
  3. pip3 install jupyter pip3 安装 jupyter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM