0
我一直在試圖使用此代碼從朱莉婭調用Python功能:朱莉婭調用Python函數
using PyCall
unshift!(PyVector(pyimport("sys")["path"]), "")
@pyimport testing
print(testing.add())
測試是在相同的路徑。
測試Python文件:
LoadError: PyError (ccall(@pysym(:PyImport_ImportModule), PyPtr, (Cstring,),
name)) <class 'ImportError'> ImportError("No module named 'testing'",)
while loading C:\Users\Benjamin\AppData\Local\JuliaPro-0.6.0.1\test.jl, in expression starting on line 410
pyerr_check at exception.jl:56 [inlined]
pyerr_check at exception.jl:61 [inlined]
macro expansion at exception.jl:81 [inlined]
pyimport(::String) at PyCall.jl:370
include_string(::String, ::String) at loading.jl:515
include_string(::Module, ::String, ::String) at Compat.jl:577
(::Atom.##55#58{String,String})() at eval.jl:73
withpath(::Atom.##55#58{String,String}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
macro expansion at eval.jl:71 [inlined]
(::Atom.##54#57{Dict{String,Any}})() at task.jl:80
我怎樣才能解決這個問題:
def add():
return 5 + 5
我從朱莉亞雖然收到此錯誤?
而且我怎麼可以這樣做: (朱):
using PyCall
unshift!(PyVector(pyimport("sys")["path"]), "")
@pyimport testing
print(testing.add(5, 5))
(蟒蛇):
def add(a, b):
return a + b
我得到了它的一個參數,功能較少但用它給我的錯誤參數的函數的工作,它期待着函數需要0個位置參數,但給出了1個。 –