【发布时间】:2020-03-09 14:24:14
【问题描述】:
我在使用 VPython 7.6.1 时遇到了一些问题。每次我想运行一行简单的代码时,我都会遇到同样的错误:
NameError: name '__server' is not defined
代码如下:
from vpython import *
box()
我浏览了其他帖子,但没有一个解决方案对我有用:
Pyo in Python; name 'Server' not defined
Error running Vpython in Spyder (NameError: name 'gsprint' is not defined)
我更改了 python 文件的名称,我重新安装了 Anaconda 并更新了我的 Python 和 VPython 版本。我正在将 Spyder 与 Anaconda 和 Python 3.7.6 一起使用。
另外,VPython 的图形使用 TKinter,所以我将图形设置更改为 TKinter,但仍然出现相同的错误。
这里有没有其他人发生过这种情况?您对如何修复它或我在这里做错了什么有任何线索吗?
这里是详细的错误:
Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
IPython 7.12.0 -- An enhanced Interactive Python.
runfile('C:/Users/lponcin/Google Drive/simplex/code_orbito.py', wdir='C:/Users/lponcin/Google Drive/simplex')
Traceback (most recent call last):
File "C:\Users\lponcin\Google Drive\simplex\code_orbito.py", line 9, in <module>
box()
File "C:\Users\lponcin\Anaconda3\lib\site-packages\vpython\vpython.py", line 1099, in __init__
super(box, self).setup(args)
File "C:\Users\lponcin\Anaconda3\lib\site-packages\vpython\vpython.py", line 579, in setup
super(standardAttributes, self).__init__()
File "C:\Users\lponcin\Anaconda3\lib\site-packages\vpython\vpython.py", line 236, in __init__
from .no_notebook import _
File "C:\Users\lponcin\Anaconda3\lib\site-packages\vpython\no_notebook.py", line 272, in <module>
__w = threading.Thread(target=__server.serve_forever)
NameError: name '__server' is not defined
【问题讨论】:
标签: python python-3.x anaconda vpython