Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

pycharm - Opencv not installing?

I've tried to install cv2 into deepnote and also into Pycharm using the following code - but nothing seems to work? Is cv2 not installable anymore? I've been using it up till last week and it was working fine but it doesn't seem to work anymore.

!pip install opencv-python
!pip install --upgrade pip

import cv2 # openCV for computer vision
import numpy as np # numpy for arrays
import pandas as pd
from matplotlib import pyplot as plt # matplotlib for plotting

Anyone have any idea what has happened? I've not changed any code whatsoever. Thanks

question from:https://stackoverflow.com/questions/65884587/opencv-not-installing

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The linked code is correct. In some environments (like Deepnote), however, you have to install extra dependencies as suggested in this answer.

!apt update
!apt install ffmpeg libsm6 libxext6  -y

Here's an example notebook of this working properly. Specifically in Deepnote, you can move the apt and pip install calls into a Custom environments Dockerfile.

In the future, please be more specific about what is not working.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...