简体   繁体   中英

VPython acts weird when used with python installation and won't shut down nicely

I want to build physics simulations using VPython. Although, VPython works great on websites like trinket.io, I'd like to use a nicer IDE than the web one, and I'd like to use real python modules as well as external libraries like numpy.

I followed the instructions at https://vpython.org/presentation2018/install.html to install VPython locally. I used the command pip install vpython (not really a fan of conda ) and wrote this simple demo program:

from vpython import sphere

sphere()

When I ran this from the command line, the program indeed worked: a browser window opened displaying the sphere. However, there are several issues with this setup:

  • When looking at the console, it keeps throwing a weird error RuntimeError: can't register atexit after shutdown . However, it still seems to run fine.
  • I couldn't find a way to nicely stop the simulation. Closing the browser tab doesn't exit the program. Pressing Ctrl+C also doesn't do anything useful. The only way to stop it is to use Ctrl+Break , which is a really dirty way, in my opinion. I tried to use stop_server as documented in that link, but no result.

Is there a way to fix these issues or maybe a different environment that will answer my needs? I really want to be able to use built-in python modules and external libraries like numpy but it seems impossible at the moment.

根据此讨论是 Python 版本的问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM