没有名为 ipykernel_launcher 的模块

Dav*_*rth 11 macos virtualenv jupyter jupyter-notebook jupyter-lab

我正在尝试将 pyenv-virtual env 注册为 MacO 上的jupiter lab内核。我在 ubuntu 上有这个工作,但我在我的 MacBook 上遇到了问题。

我按照此处的说明创建了以下内核规范文件。

{
"argv": [
"/Users/david/.pyenv/versions/python36-tf2/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "Python (3.6.8 TF2.0)",
"language": "python"
}
Run Code Online (Sandbox Code Playgroud)

我通过运行测试Users/david/.pyenv/versions/python36-tf2/bin/python -m ipykernel_launcher,它工作正常。

但是当我运行jupiter lab(系统python)然后尝试使用新内核时,它会中止并显示日志消息

/Users/david/.pyenv/versions/python36-tf20/bin/python:没有名为 ipykernel_launcher 的模块

任何想法如何修复,pyenv 绝对可以运行ipykernel_launcher

Moh*_*548 10

该错误是由于名为 的模块不可用造成的ipykernel_launcher。(参考

试试这个,这应该有效。

pip uninstall ipykernel # this may or may not be installed.
pip install ipykernel
Run Code Online (Sandbox Code Playgroud)


小智 3

正确安装pip就是答案

https://opensource.com/article/19/5/python-3-default-mac#what-to-do

在新目录中安装 pip,然后从那里再次下载 jupyter-lab。