2020年4月7日火曜日

Install OpenCV in Python3.7

TL;DR;


$ python3 -m pip install opencv-contrib-python

This worked for Python 3.7 environment.

Long version:


In my Ubuntu16.04LTS, Python2.7 and Python3.7 is co-existing. I have tried OpenCV before and did some tutorial. But now forgot settings. I needed try and error to re-install OpenCV.

$ sudo pip3 install opencv-python

is not good.  By this for Python 3.5 is installed. Downloading opencv_python-4.2.0.34-cp35-cp35m-manylinux1_x86_64.whl (28.2 MB). This doesn't work on Python 3.7.

$ pip3 install opencv-contrib-python

This was not good but it tells good WARNING.

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable

I remembered '-m pip' works.  So the command on the top,

$ python3 -m pip install opencv-contrib-python

worked. Note -m pip, not -m pip3 this time.

https://stackoverflow.com/questions/40207011/opencv-not-working-properly-with-python-on-linux-with-anaconda-getting-error-th
https://stackoverflow.com/questions/38613316/how-to-upgrade-pip3
https://stackoverflow.com/questions/57243700/import-cv2-missing-python3-7

0 件のコメント:

コメントを投稿