Factsheet
Videos
» pip install vpython
Unfortunately, you cannot install vpython as easy as normal python packages. The process is a lot more involved than that. If you want to develop using PyCharm though, you still can.
First and foremost, you need to install vpython on windows. This will likely install itself as one of your main python installation's site packages.
Install it from here -> http://vpython.org/contents/download_windows.html
After doing so, simply chose the python installation that has vpython installed.
If you wish to create a virtualenv, then do so with the --system-site-packages:
$ virtualenv --help [12:51:06]
Usage: virtualenv [OPTIONS] DEST_DIR
Options:
--version show program's version number and exit
(...)
--no-site-packages DEPRECATED. Retained only for backward compatibility.
Not having access to global site-packages is now the
default behavior.
--system-site-packages
Give the virtual environment access to the global
site-packages.
(...)
You can get the vpython working in python3.4 now. Follow this steps:
Preparation
Download the four packages TTFQuery, FontTools, and Polygon ,vpython in http://www.lfd.uci.edu/~gohlke/pythonlibs/to same directory.
Installation
- Run cmd
cd path/to/package_downloaded_directorypip install packagename.whl- Find the file
C:\Python34\lib\site-packages\vis\materials.py - Open the file in an editor, then go to line 70
- Comment the two lines just like this
class raw_texture(cvisual.texture): def __init__(self, **kwargs): cvisual.texture.__init__(self) # for key, value in kwargs.items(): # self.__setattr__(key, value)
- Save the changes
Note that when when you use vpython to code a script, the first line must be like below:
from vis import *
Below is my code sample
from vis import *
sphere(pos=vector(0,0,0),radius=0.5,color=color.red)
arrow(pos=vector(0.5,0,0),axis=vector(1,0,0),color=color.green)