朱莉娅 UndefVarError: unshift! 没有定义的

Whi*_*eok 3 python julia

我使用 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
....
Run Code Online (Sandbox Code Playgroud)

当我运行此代码时,出现以下错误:

 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
Run Code Online (Sandbox Code Playgroud)

当我搜索文件时,unshift!是 julia 1.4 中的现有函数,所以我不明白为什么会发生此错误。我是朱莉娅的新手,请帮忙。

fre*_*kre 6

不动!是 julia 1.4 中的现有功能

你在哪里看到这个的?两年前,它在 Julia 1.0 中更名为pushfirst!

julia> pushfirst!([1, 2, 3], 4)
4-element Array{Int64,1}:
 4
 1
 2
 3
Run Code Online (Sandbox Code Playgroud)

  • @logankilpatrick Biosequences.jl#v0.8.3 于 2018 年 2 月 28 日发布(比 Julia 1.0 早半年),当前版本是 2.0.5,所以也许这不是一个很好的反例? (3认同)