簡體   English   中英

無法在 macOS Big Sur 上安裝 Matplotlib

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

自從我將 MacO 升級到 Big Sur 后,我的數據科學庫出現了一些問題。 我能夠安裝 numpy 和 pandas(盡管如本主題所述,它花費了不尋常的時間)。 但是無法安裝 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

您的easy_install已過時。因此只需通過執行以下命令更新您的 setup_tools:

pip install setuptools==51

然后

easy_install --version

確保您的easy_install的版本高於 51。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM