找不到与Python 3匹配的内核.请选择一个内核



在我尝试安装和注册一个新的虚拟环境以便我可以在Jupyter笔记本中使用它之后,我最终遇到了以下问题:我打开或创建的任何笔记本都显示错误消息:"无法找到匹配Python 3的内核。请选择一个内核:"但是已经没有内核注册了…

我找不到一个好的答案,尽管我注意到许多人在过去面临同样的问题。有人能帮忙吗?

我正在使用Ubuntu和pip。

似乎是Jupyter的配置问题。

$ jupyter --paths --debug
JUPYTER_PREFER_ENV_PATH is not set, making the user-level path preferred over the environment-level path for data and config
JUPYTER_NO_CONFIG is not set, so we use the full path list for config
JUPYTER_CONFIG_PATH is not set, so we do not prepend anything to the config paths
JUPYTER_CONFIG_DIR is not set, so we use the default user-level config directory
JUPYTER_PATH is not set, so we do not prepend anything to the data paths
JUPYTER_DATA_DIR is not set, so we use the default user-level data directory
JUPYTER_RUNTIME_DIR is not set, so we use the default runtime directory
config:
/home/florian/.jupyter
/home/florian/..../OCR/ocr_env/etc/jupyter
/usr/local/etc/jupyter
/etc/jupyter
data:
/home/florian/.local/share/jupyter
jupyter kernelspec list
Available kernels:
ocr_env          /home/florian/.local/share/jupyter/kernels/ocr_env
python3          /home/florian/.local/share/jupyter/kernels/python3
spark_env        /home/florian/.local/share/jupyter/kernels/spark_env
tensorflow       /home/florian/.local/share/jupyter/kernels/tensorflow

尝试升级pip时出现另一个错误:

python -m pip install --upgrade pip
Traceback (most recent call last):
File "/home/florian/anaconda3/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/florian/anaconda3/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/__main__.py", line 23, in <module>
from pip._internal.cli.main import main as _main  # isort:skip # noqa
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/progress_bars.py", line 12, in <module>
from pip._internal.utils.logging import get_indentation
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 18, in <module>
from pip._internal.utils.misc import ensure_dir
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 33, in <module>
from pip._internal.locations import (
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/locations/__init__.py", line 9, in <module>
from . import _distutils, _sysconfig
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/locations/_sysconfig.py", line 8, in <module>
from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid
ImportError: cannot import name 'InvalidSchemeCombination' from 'pip._internal.exceptions' (/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/exceptions.py)

似乎我找到了这样一个解决方案:

pip3 install --force-reinstall jupyter_client
  1. julia> import Pkg; Pkg.add("IJulia")
  2. julia> using IJulia
  3. julia> IJulia.notebook
  4. 💚❤️💜
  5. 参考:

  • julia>正在运行julia。app on macOS
  • https://github.com/JuliaLang/IJulia.jl/issues/968 issuecomment - 739800974

相关内容

  • 没有找到相关文章

最新更新