Pycharm/Python OpenCV and CV2 install error

前端 未结 16 1716
萌比男神i
萌比男神i 2020-12-24 00:23

I\'ve been trying to install both OpenCV and cv2 from both Pycharm and from the terminal as suggested using:

pip install --user opencv
pip install --user cv2         


        
16条回答
  •  感情败类
    2020-12-24 00:46

    I had the same problem. Here are the steps for Windows 10 users.

    Open CMD: win+r then type cmd. Now,

    1. Type pip install virtualenv
    2. Create a Virtual Environment, Type virtualenv testopencv
    3. Get Inside testopencv, Type cd testopencv
    4. Activate the Virtual Environment, Type .\Scripts\activate
    5. Now Install Opencv, Type pip install opencv-contrib-python --upgrade
    6. Let's test Opencv, Type Python then import cv2 hit enter then type print(cv2.__version__) to check if its installed

    Now, open a new cmd, win + r then type cmd, repeat step 6. If it gives you an error.

    Go inside the testopencv folder, inside lib. Copy everything, go to your python directory, inside lib folder paste it and skip that are already present.

    Again open a new cmd, repeat Step 6.

    Hope it helps.

提交回复
热议问题