在Python中安装matplotlib的问题

我正在尝试使用 python 3.9 在 windows x64 中安装 matplotlib。当我做:

pip 安装 matplotlib

我收到此错误:

ERROR: Command errored out with exit status 1:

 command: 'c:\program files\python39\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Luca\\AppData\\Local\\Temp\\pip-install-zlfu5f08\\kiwisolver\\setup.py'"'"'; __file__='"'"'C:\\Users\\Luca\\AppData\\Local\\Temp\\pip-install-zlfu5f08\\kiwisolver\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Luca\AppData\Local\Temp\pip-pip-egg-info-mriih1bh'

     cwd: C:\Users\Luca\AppData\Local\Temp\pip-install-zlfu5f08\kiwisolver\

Complete output (44 lines):

WARNING: The wheel package is not available.

  ERROR: Command errored out with exit status 1:

   command: 'c:\program files\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Luca\\AppData\\Local\\Temp\\pip-wheel-pvxhkv11\\cppy\\setup.py'"'"'; __file__='"'"'C:\\Users\\Luca\\AppData\\Local\\Temp\\pip-wheel-pvxhkv11\\cppy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Luca\AppData\Local\Temp\pip-wheel-1s8s6o5r'

       cwd: C:\Users\Luca\AppData\Local\Temp\pip-wheel-pvxhkv11\cppy\

  Complete output (6 lines):

  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

     or: setup.py --help [cmd1 cmd2 ...]

     or: setup.py --help-commands

     or: setup.py cmd --help


我尝试遵循我在这里找到的所有建议,但它仍然会生成错误。


请问谁可以帮助我?


肥皂起泡泡
浏览 106回答 4
4回答

慕姐8265434

从堆栈跟踪来看,好像车轮没有安装尝试以下操作pip install wheel然后运行python setup.py bdist_wheel根据文档PIP 轮Build System Interface¶ In order for pip to build a wheel, setup.py  must implement the bdist_wheel command with the following syntax: python setup.py bdist_wheel -d TARGET This command must create a wheel compatible with the  invoking Python interpreter, and save that wheel in the  directory TARGET. No other build system commands are invoked by the pip wheel command.

侃侃无极

安装wheel后,您应该再次运行“pip install matplotlib”。就我而言,错误转向了pillow安装,在我成功安装pillow后,我终于也可以安装matplotlib了!

万千封印

尝试pip install wheel然后再试一次。

至尊宝的传说

我有同样的错误。运行后,pip install wheel我使用以下--prefer-binary标志运行安装:python -m pip install -U matplotlib --prefer-binary.文档内容如下:如果此命令导致 Matplotlib 从源代码编译并且编译出现问题,您可以添加 --prefer-binary 来选择最新版本的 Matplotlib,该版本有适用于您的操作系统和 Python 的预编译轮。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python