Obaid Ur Rehman
Obaid Ur Rehman

Reputation: 323

Pycharm gives pip error while installing CV2, PIL and other libraries?

I have been using Pycharm from a long time, I was using python 3.7 and it was working fine for me. Lately I have shifted to Machine learning and I came to know I can't use OpenCv in python 3.7 so i uninstalled python 3.7 and install python 3.6 Now When I tried to import libraries like PIL, cv2 It gave me an error that you are using version 9.0 of pip. Update it to install these packages.(I was able to use cv2 in python 3.7) So I updated it using pycharm and now it has been updated to version 18.1(could be seen in the given picture) enter image description here

Now when I try to install the packages again it still gives me this error. enter image description here

I have checked my version of pip from cmd and pip is also updated here. enter image description here

Python is installed in the location "C:\Users\Riyouk\AppData\Local\Programs\Python\Python36" I checked pip version at that location and it still gives version 18.1 enter image description here

Anyone who encountered same problem or have knowledge about this ?

Upvotes: 1

Views: 1141

Answers (1)

Dinko Pehar
Dinko Pehar

Reputation: 6061

cv2 doesn't exist as a package on PyPi.

Use:

pip install opencv-python

As documentation says:

Unofficial pre-built OpenCV packages for Python.

For Pillow, use:

pip install Pillow

Now you can import installed packages and use them:

from PIL import Image
import cv2

Upvotes: 2

Related Questions