简体   繁体   English

从Python调用Julia 0.4函数。 我如何使其工作?

[英]Calling a Julia 0.4 function from Python. How i can make it work?

I wrote an optimization function in Julia 0.4 and I want to call it from Python. 我在Julia 0.4中编写了一个优化函数,我想从Python调用它。 I'm storing the function in a .jl file in the same working directory as the Python code. 我将函数存储在与Python代码相同的工作目录中的.jl文件中。 The data to be transferred is numeric, and I think of using Numpy arrays and Julia arrays for calls. 要传输的数据是数字数据,我想使用Numpy数组和Julia数组进行调用。 Is there a tutorial on how to make this work? 有没有关于如何使这项工作的教程?

Check out the pyjulia module . 检出pyjulia模块 It allows you make calls to Julia from within Python 它允许您从Python内部调用Julia

In my experience, calling Julia using the Python pyjulia package is difficult and not a robust solution outside HelloWorld usage. 以我的经验,使用Python pyjulia软件包调用Julia很困难,而且不是HelloWorld使用方法之外的可靠解决方案。

1) pyjulia is very neglected. 1)pyjulia非常被忽略。

There is practically no documentation aside the source code. 除了源代码外,几乎没有任何文档。 For example, the only old tutorials I've found still use julia.run() that was replaced by julia.eval(). 例如,我发现的仅有的旧教程仍然使用julia.run(),而它已被julia.eval()取代。 pyjulia is not registered on PyPI, the Python Package Index. pyjulia未在PyPI(Python包索引)上注册。 Many old issues have few or no responses. 许多旧问题几乎没有回应。 And buggy, particularly with heavy memory usage and you could run into mysterious segfaults. 还有越野车,特别是在占用大量内存的情况下,您可能会遇到神秘的段错误。 Maybe, garbage collector conflicts... 也许垃圾收集器发生冲突...

2) You should limit pyjulia use to Julia functions that return simple type 2)您应该将pyjulia限制为返回简单类型的Julia函数

Julia objects imported to python using pyjulia are difficult to use. 使用pyjulia导入到python的Julia对象很难使用。 pyjulia doesn't import any type constructors. pyjulia不导入任何类型构造函数。 For example, pyjulia seems to convert complex Julia types into plain python matrix. 例如,pyjulia似乎将复杂的Julia类型转换为纯python矩阵。

3) If you can isolate the software modules and manage the I/O, you should consider the shell facility, particularly in Linux / Unix environment. 3)如果可以隔离软件模块并管理I / O,则应考虑使用Shell功能,尤其是在Linux / Unix环境中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将数组转换为 char,以便我可以从 c 中的 function 返回此 char 值。然后,在 Python 中调用它。 - how to convert array to char, so that I can to return this char value from a function in c. then, calling it in Python. 在python中关闭。 我可以在函数的本地上下文中进行闭包吗? - Closure in python. Can I make closure on local context of function? 如何使用 anaconda 将版本 pytorch 从 0.4 降级到 0.31? - How can I downgrade the version pytorch from 0.4 to 0.31 with anaconda? 朱莉娅调用Python函数 - Julia Calling Python Function 我如何在python中读取NamedTemporaryFile。 - How can i read NamedTemporaryFile in python.? 如何在Python中获取模块名称,调用特定函数。 - How to get the name of the module, calling a specific function, in Python. 为什么我不能从python中的另一个函数调用一个函数。 函数未定义错误 - why can't I call a function from another function in python. function undefined error 还是python的新手。 现在很困惑。 如何使该程序正常工作? - Still new to python. So confused right now. How do I make this program work? 我有一个用 Julia 编写的高性能函数,如何从 Python 中使用它? - I have a high-performant function written in Julia, how can I use it from Python? 如何使此Python2.6函数与Unicode一起使用? - How can I make this Python2.6 function work with Unicode?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM