为了账号安全,请及时绑定邮箱和手机立即绑定

在Python中安装matplotlib的问题

在Python中安装matplotlib的问题

肥皂起泡泡 2023-10-26 14:25:37
我正在尝试使用 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我尝试遵循我在这里找到的所有建议,但它仍然会生成错误。请问谁可以帮助我?
查看完整描述

4 回答

?
慕姐8265434

TA贡献1813条经验 获得超2个赞

从堆栈跟踪来看,好像车轮没有安装

尝试以下操作

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.


查看完整回答
反对 回复 2023-10-26
?
侃侃无极

TA贡献2051条经验 获得超10个赞

安装wheel后,您应该再次运行“pip install matplotlib”。

就我而言,错误转向了pillow安装,在我成功安装pillow后,我终于也可以安装matplotlib了!


查看完整回答
反对 回复 2023-10-26
?
万千封印

TA贡献1891条经验 获得超3个赞

尝试

pip install wheel

然后再试一次。


查看完整回答
反对 回复 2023-10-26
?
至尊宝的传说

TA贡献1789条经验 获得超10个赞

我有同样的错误。运行后,pip install wheel我使用以下--prefer-binary标志运行安装:

python -m pip install -U matplotlib --prefer-binary.

文档内容如下:

如果此命令导致 Matplotlib 从源代码编译并且编译出现问题,您可以添加 --prefer-binary 来选择最新版本的 Matplotlib,该版本有适用于您的操作系统和 Python 的预编译轮。


查看完整回答
反对 回复 2023-10-26
  • 4 回答
  • 0 关注
  • 103 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信