I try to import vpython
into anaconda. It seems to work so far, but if I call from visual import *
it gives me an error.
However, it does work when I type from vpython import *
,which is really weird since in all programs I only see the from visual import *
command.
Now to the real problem: I can't draw graphs. I have to call from visual.graph import *
but this does not work ( from vpython.graph import *
doesn't work either).
I am receiving the error below:
ImportError Traceback (most recent call last) in () ----> 1 from visual import * ImportError: No module named visual
The graph
functions now live in the main vpython library when using Jupyter. So,
from vpython import *
should be sufficient. (PS I'd recommend not importing * but rather importing the functions you plan to use or just import vpython
.)
Note however that some functions change name in the Jupyter-compatible version of VPython, so display
becomes canvas
and gdisplay
becomes graph
, and you have to explicitly use vector(x,y,z)
rather than (x,y,z)
and have to use obj.pos.x
rather than obj.x
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.