MacOS搭建OpenCV开发环境(Python)


一、Anaconda安装

按照官方安装步骤:https://docs.anaconda.com/free/anaconda/install/mac-os/ 安装即可

二、配置步骤

进入PyCharm中Preferences
在这里插入图片描述
点击下面红框中的下拉,点击Add Local Interpreter
在这里插入图片描述
按照如下所示进行配置
在这里插入图片描述
创建项目,如下所示
在这里插入图片描述

三、运行代码

代码如下(示例):

import cv2

# Load the image
img = cv2.imread('Lenna.png')

# Display the image
cv2.imshow('Lenna', img)

# Wait for a key press and then exit
cv2.waitKey(0)
cv2.destroyAllWindows()

将Lenna.png放到main.py同级目录下,运行程序,如下所示:
在这里插入图片描述

提示:更多内容可以访问Clang’s Blog:https://www.clang.asia

猜你喜欢

转载自blog.csdn.net/u012899618/article/details/131137967
今日推荐