gpt4 book ai didi

python - 无法在 macOS Big Sur 上安装 Matplotlib

转载 作者:行者123 更新时间:2023-12-03 16:32:17 26 4
gpt4 key购买 nike

自从我将 MacO 升级到 Big Sur 后,我的数据科学库出现了一些问题。我能够安装 numpy 和 pandas(尽管如 topic 所述,它花费了不寻常的时间)。但是无法安装 Matplotlib。
我已经尝试了三件事...
首先使用默认的 MacOs 嵌入 Phyton 3.8.2 。
重新安装了 numpy,升级了 pip,但是当我尝试安装 Matplotlib 时。我有以下错误:

    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
后来,我在stackoverflow上看到了一些关于类似问题的建议,一个建议使用自制软件,所以我通过brew安装了Python 3.9.0。但是,当我尝试安装 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 (...)
为了完成(几乎绝望),我尝试使用 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.
真的不知道该怎么办......在BigSur上干净安装Matplotlib是不可能的吗?哈哈哈=(

最佳答案

我做到了!!!我修理它!!
对于这个错误:

  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
我修复了安装较旧的 numpy 版本。
pip3 install --force-reinstall numpy\<1.19
它完成了任务。
对于第二个错误:
(.......) 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 (...)
这是缺少的 JPEG 库。我确实建议你们安装自制软件。
解决了这个问题:
brew install libjpeg

关于python - 无法在 macOS Big Sur 上安装 Matplotlib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64884415/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com