跳至內容

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"

已提問 1 年前檢視次數 490 次
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
已回答 1 年前
AWS
專家
已審閱 1 年前
  • 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

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。