我對 Python 編碼比較陌生,想了解 Python 中的統計和數據管理。為此,我想安裝 Matplotlib,這給了我一些問題。我看到其他人有這個問題,但我還沒有完全理解如何解決它。要安裝我使用pip install matplotlib我安裝了以下規格視窗 10蟒蛇 3.8微軟工作室 2019我遇到的第一個錯誤是安裝 Microsoft Studio,所以我這樣做了。我也嘗試過更新點子BUILDING MATPLOTLIB matplotlib: yes [3.1.1] python: yes [3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)]] platform: yes [win32] ... checkdep_freetype2.c src/checkdep_freetype2.c(1): fatal error C1083: Cannot open include file: 'ft2build.h': No such file or directory error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2 ----------------------------------------ERROR: Command errored out with exit status 1:
4 回答

寶慕林4294392
TA貢獻2021條經驗 獲得超8個贊
你有 python 3.8,而不是 python 3.7。
但是pypi 上沒有可用于 matplotlib 3.1.1 的 python 3.8 輪子。所以最好完全刪除 python 3.8 并安裝 python 3.7。
然后當你運行python -m pip install matplotlib
它時,它會從輪子上安裝已編譯的版本,因此無需自己編譯任何東西或使用 Microsoft Studio。

呼如林
TA貢獻1798條經驗 獲得超3個贊
作為一種解決方法,您可以使用“用于 Python 擴展包的非官方 Windows 二進制文件”和pip install <downloaded_filename>
.
在 Python 3.8、Windows 10 和 matplotlib-3.2 上測試
https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib
添加回答
舉報
0/150
提交
取消