首页 > 代码库 > ubuntu中pycharm配置opencv2环境

ubuntu中pycharm配置opencv2环境

在ubuntu中安装pycharm、opencv2后。在pycharm环境中无法使用opencv,后来查资料显示OpenCV is not pip-installable. You’ll need to manually sym-link your cv2.so  and cv.py  files into the site-packages directory。

经查看在/usr/local/lib/python2.7/dist-packages文件夹下有cv2.so  and cv.py

现在只需要在/usr/local/lib/python2.7/site-packages 和/usr/local/lib/python2.7/dist-packages之间建立链接即可

1
2
3
cd /usr/local/lib/python2.7/site-packages
ln -s /usr/local/lib/python2.7/dist-packages/cv.py cv.py
ln -s /usr/local/lib/python2.7/dist-packages/cv2.so cv2.so

此时就可以使用了。

ubuntu中pycharm配置opencv2环境