OpenCV and python/virtualenv?
Virtualenv creates a separate python environment. You will need to re-install all of your dependencies. EDIT it's true pip does not seem to play well with opencv. The missing module error can be resolved by copying cv shared object to your virtualenv. More info in the question linked below.
Is it possible to run opencv (python binding) from a virtualenv?
I found the solution was that I had to copy over cv2.so and cv.py to the directory running the virtualenv, then pip install numpy. To do this on Ubuntu 12.04 I used.
virtualenv virtopencv
cd virtopencv
cp /usr/local/lib/python2.7/dist-packages/cv* ./lib/python2.7/site-packages/
./bin/pip install numpy
source bin/activate
python
import cv
Python 2.7 installing opencv via pip (virtual environment)
Python 2.7 is not supported anymore in opencv-python-4.3.0.38
. Support was dropped in 4.3.0.36
; see this issue.
The workaround I found was to install opencv-python
version 4.2.0.32 (which is the latest supported for Python 2.7, see this for all releases) like this:
pip2 install opencv-python==4.2.0.32
Related Topics
Threading in a Pyqt Application: Use Qt Threads or Python Threads
How to Convert a Pandas Series or Index to a Numpy Array
How to Validate a Url with a Regular Expression in Python
Too Many Values to Unpack', Iterating Over a Dict. Key=>String, Value=>List
How to Reliably Open a File in the Same Directory as the Currently Running Script
Pip Uses Incorrect Cached Package Version, Instead of the User-Specified Version
How to Install Both Python 2.X and Python 3.X in Windows
Evenly Distributing N Points on a Sphere
Can "List_Display" in a Django Modeladmin Display Attributes of Foreignkey Fields
Differencebetween Flatten and Ravel Functions in Numpy
How to Execute a File Within the Python Interpreter
Count Unique Values Per Groups with Pandas
How to Install Python MySQLdb Module Using Pip
Iterate Over Model Instance Field Names and Values in Template
Logging Uncaught Exceptions in Python
Django Auto_Now and Auto_Now_Add