gpt4 book ai didi

python - 为 PyJulia 编译和使用自定义系统镜像

转载 作者:行者123 更新时间:2023-12-04 15:15:08 64 4
gpt4 key购买 nike

我尝试按照 this page 上的说明进行操作构建自定义 Julia 系统镜像,以便在使用 PyJulia 时加快初始化阶段。
命令 python3 -m julia.sysimage sys.so成功搭建sys.so图像,然后 jl = Julia(sysimage="sys.so")似乎失败了,因为我仍然得到:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "/home/jar/.local/lib/python3.7/site-packages/julia/core.py", line 248, in load_module
elif self.julia.isafunction(juliapath):
File "/home/jar/.local/lib/python3.7/site-packages/julia/core.py", line 239, in julia
self.__class__.julia = julia = Julia()
File "/home/jar/.local/lib/python3.7/site-packages/julia/core.py", line 483, in __init__
raise UnsupportedPythonError(jlinfo)
julia.core.UnsupportedPythonError: It seems your Julia and PyJulia setup are not supported.

Julia executable:
julia
Python interpreter and libpython used by PyCall.jl:
/usr/bin/python3
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
Python interpreter used to import PyJulia and its libpython.
/usr/bin/python3.7
None

Your Python interpreter "/usr/bin/python3.7"
is statically linked to libpython. Currently, PyJulia does not fully
support such Python interpreter.
这与我试图通过首先编译此自定义图像来解决的问题相同。
我究竟做错了什么?我想避免 Julia(compiled_modules=False)解决方法,因为它实际上需要永远。

最佳答案

似乎与this issue有关,以及以下 workaround加载自定义图像似乎工作:

from julia.api import LibJulia
api = LibJulia.load()
api.sysimage = "PATH/TO/CUSTOM/sys.so"
api.init_julia()

from julia import Main

关于python - 为 PyJulia 编译和使用自定义系统镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64486932/

64 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com