简体   繁体   中英

How do I run an installed Python module on Windows?

I am working with a Point Grey camera (Grasshopper3) and I analyse the images using OpenCV in Python. Point Grey cameras come with an API in C named flycapture. I found python bindings for the flycapture v2 api on GitHub ( pyflycapture2 ) and they provide installation instructions for Unix systems, but since I'm on Windows, I cannot use the awesome apt-get command.

Here is the instructions provided:

mkdir ~/git
cd ~/git
git clone https://github.com/peterpolidoro/pyflycapture2.git
sudo apt-get install python-pip python-virtualenv -y
mkdir ~/virtualenvs/
virtualenv ~/virtualenvs/flycapture2
source ~/virtualenvs/flycapture2/bin/activate
pip install cython
pip install numpy
cd ~/git/pyflycapture2/
python setup.py install

I don't need to install Cython and NumPy since they are included in my Python distribution (Anaconda)

I tried running only python setup.py install but then I get ImportError: No module named flycapture2 if I test the installation with the code provided in the repository.

Any help would be really appreciated!

Thanks to Busturdust who pointed out that the issue had already been covered here : https://github.com/jordens/pyflycapture2/issues/8

In summary, new Point Grey cameras don't use the same frame rate format convention then the one used in the module.

You should try importing the newly installed module from outside the source directory, and not from where you installed it with python setup.py install . So run your command from your home directory for example.

If you are running python 3.4, I believe pip should be with the distribution, but I am not sure about anaconda. Try invoking it as python -m pip install [module]

edit: comment appears to have helped solve the issue, adding it to the answer:

"If you have all the dependencies installed, just download the distribution as a zip cleanly, unzip the folder to a temproary location cd to that location and run python setup.py install "

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