How do I run an installed Python module on Windows?

早过忘川 提交于 2019-12-24 16:35:27

问题


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!


回答1:


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.




回答2:


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.




回答3:


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"



来源:https://stackoverflow.com/questions/33548016/how-do-i-run-an-installed-python-module-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!