raku - 跨 raku shell 命令维护 python 虚拟环境
问题描述
有没有办法在一个 raku shell 命令中激活 python 虚拟环境,然后在下一个 shell 命令中访问该环境?我想在 raku 中做这样的事情。假设在“some_env”环境下有一个名为“execute_software”的可执行文件:
shell("source some_env");
shell("execute_software XXX XXX");
shell("source deactivate");
目前,这对我不起作用。
谢谢!
陶
解决方案
我不知道您希望程序退出后环境如何保持。
据我所知,这不是你可以做的任何事情。
如果这是您想要的,我可以建议使用 Inline::Python 吗?
use Inline::Python;
my $py = Inline::Python.new();
$py.run('print("hello world")');
use string:from<Python>;
say string::capwords('foo bar'); # prints "Foo Bar"