vpython / vpython-jupyter

3D visualization made easy
MIT License
141 stars 64 forks source link

installed python 3.10 raises an exception #176

Open Whiskeysaurus opened 3 years ago

Whiskeysaurus commented 3 years ago
import vpython

File "C:\Users\justi\AppData\Roaming\Python\Python310\site-packages\vpython__init__.py", line 25, in raise Exception(s) Exception: The non-notebook version of vpython requires Python 3.5 or later. vpython does work on Python 2.7 and 3.4 in the Jupyter notebook environment.

amad3v commented 2 years ago

You can edit the __init__.py of vpython from:

__ispython3 = (__p[0] == '3')
__require_notebook = (not __ispython3) or (__p[2] < '5') # Python 2.7 or 3.4 require Jupyter notebook

to:

__ver = [int(i) for i in __p.split(".")]
__ispython3 = __ver[0] == 3
__require_notebook = (not __ispython3) or (
    __ver[1] < 5
)  # Python 2.7 or 3.4 require Jupyter notebook

Or you can follow the changes made in this file which will be in the next version.