python - 无法在 jupyter 笔记本中注册/访问/使用 conda 虚拟环境
问题描述
SO上有很多与此相关的问题,但是所有答案似乎都不适合我。
问题:
我有一个名为rideaux 的conda 环境。我希望从我的 jupyter 笔记本中访问这个环境。但是,在 jupyter 笔记本中,唯一可用的内核是默认内核。
为了测试,我尝试导入 conda 环境中可用的包,但正如预期的那样,这在可用内核中不起作用。
我尝试了什么:
首先,我尝试在rideaux 环境中简单地运行jupyter notebook 服务器。这与上图没有任何变化,即rideaux 内核不可用。
接下来,我尝试使用该
nb_conda_kernels
软件包。我安装conda install -n notebook_env nb_conda_kernels
在我的基础环境和我的rideaux 环境中。我也安装ipykernel
在我的rideaux 环境中conda install ipykernel
。然后,从rideaux 环境启动一个笔记本服务器,结果与上图没有任何变化。我试图通过
ipython kernel install --user --name=rideaux
在rideaux 环境中运行来注册conda 环境。这导致没有任何变化。
一般信息和故障排除。
which jupyter
在rideaux 环境中运行会从环境内部返回一个可执行文件。
运行jupyter kernelspec list
返回以下内容。这python3
似乎是上图中看到的那个。那为什么rideaux内核没有出现呢?
Available kernels:
rideaux /home/mjpvanzuijlen/.local/share/jupyter/kernels/rideaux
python3 /home/mjpvanzuijlen/anaconda3/envs/rideaux/share/jupyter/kernels/python3
在笔记本中运行!jupyter-troubleshoot
会返回以下输出。它没有提到rideaux
环境,返回的环境which jupyter
也在这里不可见。这可能意味着正在运行错误的 jupyter?我不知道。
$PATH:
/snap/jupyter/6/bin
/snap/jupyter/6/usr/sbin
/snap/jupyter/6/usr/bin
/snap/jupyter/6/sbin
/snap/jupyter/6/bin
/home/mjpvanzuijlen/snap/jupyter/common/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
sys.path:
/snap/jupyter/6/bin
/snap/jupyter/6/lib/python37.zip
/snap/jupyter/6/lib/python3.7
/snap/jupyter/6/lib/python3.7/lib-dynload
/snap/jupyter/6/lib/python3.7/site-packages
sys.executable:
/snap/jupyter/6/bin/python3.7
sys.version:
3.7.3 | packaged by conda-forge | (default, Mar 27 2019, 23:01:00)
[GCC 7.3.0]
platform.platform():
Linux-4.15.0-140-generic-x86_64-with-glibc2.10
which -a jupyter:
/snap/jupyter/6/bin/jupyter
/snap/jupyter/6/bin/jupyter
解决方案
推荐阅读
- virtualbox - 如何在 nixos 来宾系统中缩小 VirtualBox 虚拟机并释放磁盘空间?
- swift - Swift 4.2:[Swift._EmptyArrayStorage _getValue:forType:]:无法识别的选择器
- bash - 如何使用 ssh 直接连接到远程 docker 容器
- javascript - 如何将响应转为 Excel 文件
- dovecot - Dovecot Sieve - 如何检索部分消息作为变量
- python - 基于变量(str)的Django动态过滤器
- python - 在 pandas 中记录条件条目的位置
- reporting-services - 当值为空时从图表图例中隐藏“Series1”
- c# - FluentMigrator - 在删除之前检查外键是否存在
- sql - SQL - 同时限制和过滤连接