简体   繁体   English

在环境中启动 Jupyter 失败

[英]Failed to start Jupyter in the environment

The Python version in my Conda environment (nf_base) is 3.9.4.我的 Conda 环境(nf_base)中的 Python 版本是 3.9.4。 However, when I try to run python code in an existing Jupyter notebook in VS-Code, I receive the following error message:但是,当我尝试在 VS-Code 中的现有 Jupyter 笔记本中运行 python 代码时,我收到以下错误消息:

Failed to start Jupyter in the environment 'Python 3.10.1 64-bit (/usr/local/bin/python3)'.无法在“Python 3.10.1 64 位 (/usr/local/bin/python3)”环境中启动 Jupyter。 SyntaxError: Missing parentheses in call to 'print'. SyntaxError:调用“打印”时缺少括号。 Did you mean print(...)?你的意思是打印(...)? View Jupyter log for further details.查看 Jupyter 日志以获取更多详细信息。

Which python returned the following path: /usr/bin/python其中 python 返回以下路径:/usr/bin/python

Trying to use: conda deactivate conda deactivate conda activate nf_base which python尝试使用: conda deactivate conda deactivate conda activate nf_base which python

returned the following path: source /opt/homebrew/Caskroom/miniconda/base/bin/activate返回以下路径: source /opt/homebrew/Caskroom/miniconda/base/bin/activate

Unfortunately, the same error message occurs once the code is ran.不幸的是,一旦运行代码,就会出现相同的错误消息。

Check if you have ipykernel installed.检查您是否安装了 ipykernel。 use this for pip3 python installation:将此用于 pip3 python 安装:

sudo apt install python3-pip

then use this to install ipykernel: pip3 install ipykernel Use these commands in VScode terminal and also reinstall jupyter extension in Vs code.然后使用它来安装 ipykernel: pip3 install ipykernel在 VScode 终端中使用这些命令,并在 Vs 代码中重新安装 jupyter 扩展。 then create a new enviroment and restart the Vscode last time close all terminals in Vs code and then it should support the kernel.然后创建一个新环境并重新启动 Vscode 上次关闭 Vs 代码中的所有终端,然后它应该支持 kernel。

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

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