[英]Jupyter notebook: how to run python shell command on current kernel?
I'm trying to run a simple 我正在尝试运行一个简单的
!python script.py
command within a Jupyter notebook running on a custom kernel (virtual environment) where I installed a number of modules. 在我安装了许多模块的自定义内核(虚拟环境)上运行的Jupyter笔记本中的命令。 When I run the above command, I am getting some errors related to missing modules, meaning it is not running that code on the same virtual environment as the jupyter notebook.
当我运行上面的命令时,我得到一些与缺少模块相关的错误,这意味着它没有在与jupyter笔记本相同的虚拟环境中运行该代码。
Is there any way to solve this? 有什么方法可以解决这个问题吗?
First activate the virtual env then start your notebook.Then it will have your activated virtual env packages 首先激活虚拟环境然后启动你的笔记本。然后它将有你激活的虚拟环境包
source stackpy/bin/activate
sudo jupyter notebook --allow-root
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.