내용으로 건너뛰기

OpenCV for Sagemaker

0

How can I import OpenCV in a python sagemaker notebook? Every time I try I always get an error with the following line : "import cv2"

질문됨 일 년 전497회 조회
1개 답변
1

To import OpenCV in a Python SageMaker notebook, you can follow these steps:

Install the
opencv-python-headless
package instead of the regular
opencv-python
package. This headless version of OpenCV does not require additional GUI libraries, which can cause issues in a SageMaker notebook environment.

%pip install opencv-python-headless

After installing the package, you should be able to import cv2 without any issues

AWS
답변함 일 년 전
AWS
전문가
검토됨 일 년 전
  • Agree with this but the formatting is a bit off: I think you want your triple-backticks around %pip install opencv-python-headless rather than the preceding block :D

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠