Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 巨蟒:“;名称错误:全局名称';箭头';“未定义”;_Python_Ubuntu_Nameerror_Wine_Vpython - Fatal编程技术网

Python 巨蟒:“;名称错误:全局名称';箭头';“未定义”;

Python 巨蟒:“;名称错误:全局名称';箭头';“未定义”;,python,ubuntu,nameerror,wine,vpython,Python,Ubuntu,Nameerror,Wine,Vpython,我是Python的初学者,我正在尝试运行以下代码: 当我试图执行此代码时,出现以下错误: Traceback (most recent call last): File "C:\simulations\ising\ising.py", line 53 spstate(state) # plots initial state: all spins down File "C:\simulations\ising\ising.py", lin

我是Python的初学者,我正在尝试运行以下代码:

当我试图执行此代码时,出现以下错误:

Traceback (most recent call last):
  File "C:\simulations\ising\ising.py", line 53
    spstate(state)                      # plots initial state: all spins down
  File "C:\simulations\ising\ising.py", line 47, in spstate
    arrow(pos=(i,ypos,0), axis=(0,5*state[j],0), color=arrowcol)
NameError: global name 'arrow' is not defined
这很奇怪,因为箭头应该是VPython的函数:

我在Ubuntu12.04中与VIDLE VPython一起在wine下运行这个

如果我从Ubuntu本机运行此代码,它仍然不会执行,但错误消息不同:

(python:12493): GdkGLExt-WARNING **: Cannot open \u000c

(python:12493): GdkGLExt-WARNING **: Cannot open \xa0\xbc\u0005X\x8a\u007f
(python:12493): glibmm-ERROR **: 
unhandled exception (type std::exception) in signal handler:
what: Unable to get extension function: glCreateProgramObjectARB even though the extension is advertised.

Trace/breakpoint trap (core dumped)

由于我不太熟悉Python编程和错误消息,我有点迷路了,不知道从哪里开始查找错误源。

基本上这意味着函数
箭头
不存在。我假设它应该是visual.graph模块的一部分。您可能需要联系模块的提供商以查找根本原因。它可能是一个已存在的函数,但您仍必须导入它。您是否按照教程所示从visual import*
执行了
“从visual import*”执行了此操作,非常感谢!