跨 raku shell 命令维护 python 虚拟环境

Tao*_*ang 7 raku

有没有办法在一个 raku shell 命令中激活 python 虚拟环境,然后在下一个 shell 命令中访问 env?我想在乐中做这样的事情。假设在“some_env”环境下有一个名为“execute_software”的可执行文件:

shell("source some_env");
shell("execute_software XXX XXX");
shell("source deactivate");
Run Code Online (Sandbox Code Playgroud)

目前,这对我不起作用。

谢谢!

Bra*_*ert 3

我不知道程序退出后您如何期望环境保持不变。
据我所知,这不是你可以用任何东西做的事情。

如果这是你想要的,我可以建议使用 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"
Run Code Online (Sandbox Code Playgroud)