[英]How correct the import error of libpng15 for cv2?[resolve]
I'm trying to install opencv to use yolov4 but I have encountered an issue when I try to import cv2 on python:我正在尝试安装 opencv 以使用 yolov4,但是当我尝试在 python 上导入 cv2 时遇到问题:
ImportError: libpng15-c2ffaf3d.so.15.13.0: cannot open shared object file: No such file or directory
I have installed opencv with:我已经安装了 opencv:
sudo apt install libopencv-dev python3-opencv
and I try:我尝试:
sudo apt-get install libpng-dev
but it didn't help.但这没有帮助。
I have found nothing on libpng15-c2ffaf3d
on the internet so if someone can help it will save me.我在互联网上的
libpng15-c2ffaf3d
上一无所获,所以如果有人可以帮助它会救我。
It seems the package is not located where python is searching,You can try package 似乎不在 python 正在搜索的位置,您可以尝试
Solution:解决方案:
apt-get update
apt-get install -y libsm6 libxext6 libxrender-dev
pip install opencv-python
I was having the same issue in my Linux environment of pythonanywhere.我在 pythonanywhere 的 Linux 环境中遇到了同样的问题。 I created the virtual environment and installed my package of open-cv using:
我创建了虚拟环境并使用以下命令安装了 open-cv 的 package:
pip install opencv-contrib-python
But it was raising this exception:但它引发了这个例外:
ImportError at /: libpng15-c2ffaf3d.so.15.13.0: cannot open shared object file: No such file or directory
Then I installed another package using:然后我安装了另一个 package 使用:
pip install opencv-python
which resolved my issue.这解决了我的问题。
Make sure you install it in the same virtual environment.确保将其安装在相同的虚拟环境中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.