Error running Vpython in Spyder (NameError: name 'gsprint' is not defined)

偶尔善良 提交于 2020-04-30 14:30:21

问题


NameError: name 'gsprint' is not defined

I repeatedly get this error message when trying to run this:

from vpython import *
box()

I am using Python 3.7.3 and Spyder 3.3.4, and cannot find any help in documentation. Vpython website says I should be able to run it:

https://vpython.org/presentation2018/install.html


回答1:


I had the same issue: I kept getting these "NameError: name 'gsprint' is not defined" error messages when running codes with the from vpython import * line. Strangely, the same codes on Anaconda/Spyder in another computer were working fine.

I ended up in this page while looking for a solution. I tried the simple vpython code above and got the same error message running from spyder while it worked fine running directly in the Anaconda prompt. I checked that the vpython version in the environment is 7.5.0.

My solution: an overall update on Anaconda

conda update --all

I'm now running with Spyder 3.3.6 and Python 3.7.3 and the code is working fine.



来源:https://stackoverflow.com/questions/56145089/error-running-vpython-in-spyder-nameerror-name-gsprint-is-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!