导入matplotlib时,出现以下错误:
Traceback (most recent call last):
File "/home/adama/Code/MachineLearning/HW6/problem1.py", line 6, in <module>
import matplotlib
File "/usr/lib/python3.11/site-packages/matplotlib/__init__.py", line 161, in <module>
from . import _api, _version, cbook, _docstring, rcsetup
File "/usr/lib/python3.11/site-packages/matplotlib/rcsetup.py", line 27, in <module>
from matplotlib.colors import Colormap, is_color_like
File "/usr/lib/python3.11/site-packages/matplotlib/colors.py", line 52, in <module>
from PIL import Image
File "/home/adama/.local/lib/python3.11/site-packages/PIL/Image.py", line 94, in <module>
from . import _imaging as core
ImportError: libimagequant.so.0: cannot open shared object file: No such file or directory
我尝试通过我的操作系统(Manjaro)包管理器和 pip 删除并重新安装 matplotlib 和 libimagequant。我还尝试编辑 ld.so.conf 文件并运行 ldconfig,这是文件的当前内容:
# Dynamic linker/loader configuration.
# See ld.so(8) and ldconfig(8) for details.
include /etc/ld.so.conf.d/*.conf
/usr/local/lib
include /usr/local/lib
include /usr/.local/lib
我也尝试安装 TA-lib,但这些都没有任何作用。我认为问题的根源是因为我使用了 pip --break-system-packages。我正在考虑删除 python 和所有包,但我真的不想这样做。
您是否尝试将文件 /lib/libimagequant.so.0.4 重命名为 libimagequant.so.0 我打开工具时确实遇到了同样的问题,但重命名文件后一切都很好