小编Al_*_*l_P的帖子

如何在 IPython shell 中获取或激活虚拟环境?

我使用 IPython 和%bookmarkmagic 命令,但限制是我需要退出 IPython shell 才能激活虚拟环境,然后重新启动 IPython。

有没有办法内置到 IPython、第三方包或已知的 hack 中,让我在不退出 IPython shell 的情况下激活环境?

实际工作流程

# within ipython shell
exit

# bash shell
cd path/of/my/project
poetry shell  # or pipenv shell
ipython
Run Code Online (Sandbox Code Playgroud)

预期工作流程

%cd -b demographics

# activate venv 

import package # from that env
Run Code Online (Sandbox Code Playgroud)

python virtualenv ipython pipenv python-poetry

4
推荐指数
1
解决办法
1490
查看次数

标签 统计

ipython ×1

pipenv ×1

python ×1

python-poetry ×1

virtualenv ×1