我正在尝试为我的诗歌环境安装一个Jupyter内核,但是内核似乎得到了我的基本conda环境。这是我正在尝试的:
poetry env list
>ENV_NAME-HASH-py3.9 (Activated)
poetry run which python
>/Users/myusername/Library/Caches/pypoetry/virtualenvs/ENV_NAME-HASH-py3.9/bin/python
poetry run ipython kernel install --name=ENV_NAME
>Installed kernelspec ENV_NAME in /Users/myusername/Library/Jupyter/kernels/ENV_NAME
然后,如果我用这个内核打开一个Jupyter,我不会得到应该安装的库。检查Python版本我得到:
!which python
/Users/myusername/opt/anaconda3/bin/python
感谢任何帮助!
您是否尝试先激活您的环境?(使用source {path to env}/bin/activate
?如果是这样,您可以尝试直接安装ipykernel:poetry run python -m ipykernel install --user --name myname
可能您没有使用与环境相同的内核。(假设您已经设置并运行了您的诗歌)您可以通过poetry add --group dev jupyter
将jupyter添加到您的诗歌环境中然后运行-poetry run jupyter notebook