从Python脚本获取Julia版本

发布于 2025-02-09 05:54:25 字数 566 浏览 2 评论 0原文

我正在尝试从Python脚本中获取Julia版本。

C:\Users> julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.0.3 (2018-12-18)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |

julia> VERSION
v"1.0.3"

julia> exit()
C:\Users>

这就是我在CMD中这样做的方式。

寻找一种使用Python访问此版本值的方法。

使用OS.System('Julia')时,它永远不会退出此阶段,因为我想它正在等待此朱莉娅环境中的命令。

I'm trying to get the Julia version from a python script.

C:\Users> julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.0.3 (2018-12-18)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |

julia> VERSION
v"1.0.3"

julia> exit()
C:\Users>

This is the way I do it in CMD.

Looking for a way to access this version value using python.

When using os.system('julia') it never exits this stage because I guess it is waiting for a command within this Julia environment.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

止于盛夏 2025-02-16 05:54:25

您可以使用Julia解释器的 command-noreferrer“> command-line”选项 shell中的代码> -v :

julia -v

此系统命令也可以使用eg subprocess从python中调用,

version_output = subprocess.check_output(['julia', '-v'])
print(version_output)

请参见运行shell命令并捕获输出

You can use the julia interpreter's command-line option -v in the shell:

julia -v

This system command can also be invoked from within Python using e.g. subprocess:

version_output = subprocess.check_output(['julia', '-v'])
print(version_output)

See Running shell command and capturing the output

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文