简体   繁体   English

无法在 macOS Big Sur 上安装 Matplotlib

[英]Can't install Matplotlib on macOS Big Sur

Since I've upgraded my MacOs to Big Sur I'm having some trouble with my data science libraries.自从我将 MacO 升级到 Big Sur 后,我的数据科学库出现了一些问题。 I was able to install the numpy and pandas (even though it took an unusual amount of time as stated at this topic ).我能够安装 numpy 和 pandas(尽管如本主题所述,它花费了不寻常的时间)。 But can't manage to install the Matplotlib.但是无法安装 Matplotlib。

I've tried three things... First with the default MacOs embedded Phyton 3.8.2 .我已经尝试了三件事......首先是默认的 MacOs 嵌入式 Phyton 3.8.2 。 Reinstalled numpy, upgraded pip, but when I've tried to install Matplotlib.重新安装了 numpy,升级了 pip,但是当我尝试安装 Matplotlib 时。 I've got the following error:我有以下错误:

    RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
RankWarning: Polyfit may be poorly conditioned

Later, I've seen some suggestions here at stackoverflow for similar problems, one suggested to use homebrew, so I've installed Python 3.9.0 through brew.后来,我在stackoverflow上看到了一些关于类似问题的建议,一个建议使用自制软件,所以我通过brew安装了Python 3.9.0。 However, when I've tried to install Matplotlib, still got a giant error, when it was trying to install Pillow:但是,当我尝试安装 Matplotlib 时,在尝试安装 Pillow 时仍然出现一个巨大的错误:

(.......) The headers or library files could not be found for jpeg,a required dependency when compiling 
Pillow from source.Please see the install instructions at:
https://pillow.readthedocs.io/en/latest/installation.html
ERROR: Command errored out with exit status 1: /usr/local/opt/python@3.9/bin/python3.9 (...)

To finish (in almost despair) I've tried to create a virtual environment using venv (& Python 3.8.2) and was able to install NumPy successfully, however, I've got the following error trying to install Matplotlib:为了完成(几乎绝望),我尝试使用 venv(和 Python 3.8.2)创建一个虚拟环境并且能够成功安装 NumPy,但是,我在尝试安装 Matplotlib 时遇到以下错误:

(...... long line of code....) The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.

Really don't know what to do... Is it impossible to use Matplotlib with a clean install on BigSur?真的不知道该怎么办......在BigSur上干净安装Matplotlib是不可能的吗? hahaha =(哈哈哈=(

I did it!!!我做到了!!! I fix it!!我修理它!!

For this error :对于这个错误:

  RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend.
 If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
 RankWarning: Polyfit may be poorly conditioned

I fixed installing an older numpy version.我修复了安装较旧的 numpy 版本。

pip3 install --force-reinstall numpy\<1.19

It did the job.它完成了任务。

For the second error:对于第二个错误:

(.......) The headers or library files could not be found for jpeg,a required dependency when compiling 
Pillow from source.Please see the install instructions at: https://pillow.readthedocs.io/en/latest/installation.html
ERROR: Command errored out with exit status 1: /usr/local/opt/python@3.9/bin/python3.9 (...)

It was the missing JPEG library.这是缺少的 JPEG 库。 I do recommend you guys install homebrew.我确实建议你们安装自制软件。 Solved this problem with:解决了这个问题:

brew install libjpeg

your easy_install is outdated.so just update your setup_tools by excuting following command:您的easy_install已过时。因此只需通过执行以下命令更新您的 setup_tools:

pip install setuptools==51

then然后

easy_install --version

make sure your easy_install 's version is above 51.确保您的easy_install的版本高于 51。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM