https://www.ximea.com/support/wiki/apis/python_inst_win
Python API - Windows installation steps¶
How to install the Ximea Python module:¶
To install our Python API into your Windows system please follow these steps:- Install the Beta Release of the Ximea API SP - Select xiApiPython checkbox in the API list.
- Install Python - Download version suitable for your architecture from https://www.python.org/downloads/ and install it.
- Set Python path - Necessary if you want to use python from command prompt. This is the path to directory, where Python is installed. Go to Control Panel > System > Advanced system settings > Environment Variables > System variables > Path and click "Edit...". Add to the end of Variable value: ";C:\PythonXY;C:\PythonXY\Scripts" (without quotes), where XY is the version and subversion of installed Python. E.g. for Python2.7, add ";C:\Python27;C:\Python27\Scripts" (In case Python is installed in a different location, please add path to this location). It may be necessary to restart your computer for the changes to take effect.
- Install the Ximea module - Copy the whole folder \XIMEA\API\Python\v{x}\ximea (depending on the Python version) to site-packages.
- for Python 2.x copy ximea folder placed in \XIMEA\API\Python\ v2\
- for Python 3.x copy ximea folder placed in \XIMEA\API\Python\ v3\
You can find the site-packages folder if you write this command into command prompt (path to python must be set correctly, see step 2.):python -c "import site;print(site.getsitepackages())"
You should see that the one of the paths is the path to the site-packages (e.g. C:\\Python27\\lib\\site-packages). To check if it is OK, in Python run:import ximea print(ximea.__version__)
Additional tools installation:¶
The following steps are optional. However, these steps are necessary for running all examples:
- pip (package manager) - Python versions >=2.7.9 and >=3.4 has pip already installed, so try to write this command into the command prompt:
pip --version
It should print the version of the pip. If not, please check if the path is correctly set (see step 2. above). If it is set correctly and you have an older version of Python, install pip from this page or consider upgrading to a newer version of Python. - numpy (highly recommended) - Simply using pip, in command prompt write:
pip install numpy
and then in python run:import numpy numpy.__version__
- matplotlib - In command prompt write:
pip install matplotlib
and then in python run:import matplotlib matplotlib.__version__
- Pillow - In the command prompt write:
pip install Pillow
and then in python run:import PIL PIL.__version__
- OpenCV
- only Python 2.7.x
Follow steps 4. - 7. from OpenCV webpage: http://docs.opencv.org/3.1.0/d5/de5/tutorial_py_setup_in_windows.html - Python >=3.6
pip install opencv-python
and then in python run:import cv2 cv2.__version__
Examples¶
See the examples folder: \XIMEA\API\Python\examples