python3 安装 matplotlib 失败
如上图,报这样的Fail
解决办法:
这个错误通常表示在安装 Pillow 库时出现了问题。出现这个错误可能有多种原因,例如依赖项不全、编译器问题等。
尝试以下解决方案:
-
安装 Pillow 的依赖项。在 Ubuntu 系统上,可以使用以下命令安装:
sudo apt-get install libjpeg-dev zlib1g-dev libtiff-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
安装完以后,再次使用pip3 install matplotlib
进行安装,
root@unassigned:~/test/FW# pip3 install matplotlib
Collecting matplotlib
Using cached https://files.pythonhosted.org/packages/09/03/b7b30fa81cb687d1178e085d0f01111ceaea3bf81f9330c937fb6f6c8ca0/matplotlib-3.3.4-cp36-cp36m-manylinux1_x86_64.whl
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /usr/local/lib/python3.6/dist-packages (from matplotlib)
Requirement already satisfied: numpy>=1.15 in /usr/local/lib/python3.6/dist-packages (from matplotlib)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib)
Collecting pillow>=6.2.0 (from matplotlib)
Using cached https://files.pythonhosted.org/packages/7d/2a/2fc11b54e2742db06297f7fa7f420a0e3069fdcf0e4b57dfec33f0b08622/Pillow-8.4.0.tar.gz
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/dist-packages (from matplotlib)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.1->matplotlib)
Building wheels for collected packages: pillow
Running setup.py bdist_wheel for pillow ... done
Stored in directory: /root/.cache/pip/wheels/a7/69/9a/bba9fca6782340f88dbc378893095722a663cbc618e58fe401
Successfully built pillow
Installing collected packages: pillow, matplotlib
Successfully installed matplotlib-3.3.4 pillow-8.4.0
安装成功!!!
CentOS 安装失败:
python3 -m pip install --upgrade pip
pip3 install pillow
pip3 install matplotlib