python - Jupyter kernel points to the wrong Python
问题描述
I create a conda environment, activate install ipykernel, add it to jupyter kernelspec. This far, all works fine.
conda create -n MYENV python
conda activate MYENV
conda install ipykernel
python -m ipykernel install --user --name MYENV
conda deactivate
jupyter kernelspec list
MYENV /home/kara/.local/share/jupyter/kernels/MYENV
Then I launch the jupyter notebook on my base environment, and select the added kernel. However, while this kernel still runs, it uses the python from the base environment.
When I type !which python
in the notebook, it returns "/home/kara/anaconda3/bin/python" while my python in that environment is actually in;
conda activate MYENV
which python
/home/kara/anaconda3/envs/MYENV/bin/python
How can I get jupyter to find the correct python? Now, when I install a package in that environment, jupyter cannot find it. I suspect it's because the package install to a different environment.
解决方案
推荐阅读
- database - 如何在父表中实现与子表的继承关系
- r - 使用特定公式仅替换 xts 对象列中的 NA 值
- rdf - 允许物化的 RDF 三重存储
- excel - VBA:清除多个不连续的单元格
- python-3.x - 如何避免读取 pandas.read_excel 中的空行
- laravel - 运行作业的用户与网络服务器(apache)用户之间的 Laravel 文件权限不兼容
- c - 未声明的 'yylex' 和 'yyin'
- javascript - 如何从Ruby变量存储在Javascript中的localStorage
- android - 使用导航组件在不同图形之间导航
- tfs - Azure Devops 指定较短的路径错误