gpt4 book ai didi

python - Julia UndefVarError : unshift! 未定义

转载 作者:行者123 更新时间:2023-12-04 00:54:38 25 4
gpt4 key购买 nike

我使用 julia 1.4,并运行以下代码:

using PyCall
using JLD
using ArgParse
using Pandas
@pyimport networkx as nx
@pyimport scipy.sparse.csgraph as csg
@pyimport numpy as np

unshift!(PyVector(pyimport("sys")["path"]), "")
# unshift!(PyVector(pyimport("sys")["path"]), "..")
unshift!(PyVector(pyimport("sys")["path"]), "combinatorial")
@pyimport utils.load_graph as lg
@pyimport utils.distortions as dis
@pyimport graph_util as gu
....
当我运行此代码时,出现以下错误:
 ERROR: LoadError: UndefVarError: unshift! not defined
Stacktrace:
[1] top-level scope at /root/hyperbolics/combinatorial/comb.jl:9
[2] include(::Module, ::String) at ./Base.jl:377
[3] exec_options(::Base.JLOptions) at ./client.jl:288
[4] _start() at ./client.jl:484
in expression starting at /root/hyperbolics/combinatorial/comb.jl:9
当我搜索文件时,unshift!是 julia 1.4 中的现有函数,所以我不明白为什么会发生此错误。我是 Julia 的新手,请帮忙。

最佳答案

unshift! is existing function in julia 1.4


你在哪里看到这个的?它在两年前为 Julia 1.0 重命名为 pushfirst! :
julia> pushfirst!([1, 2, 3], 4)
4-element Array{Int64,1}:
4
1
2
3

关于python - Julia UndefVarError : unshift! 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63490410/

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