Python 无法使用 pip 安装 matplotlib

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48456125/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 18:43:09  来源:igfitidea点击:

Unable to install matplotlib using pip

pythonmatplotlibpip

提问by AlpinistGuy

I just build a pc and I have been trying to install matplotlib on it using pip, but for some reason I keep getting this error

我只是构建了一台电脑,我一直在尝试使用 pip 在其上安装 matplotlib,但由于某种原因,我不断收到此错误

Command "python setup.py egg_info" failed with error code 1

I am on windows 10, using python 2.7 and I use

我在 Windows 10 上,使用 python 2.7,我使用

pip install matplotlib

Has this happened to anyone else, and what do I need to do to fix it? It also does this when I try to install pandas as well.

其他人是否发生过这种情况,我需要做些什么来解决它?当我尝试安装 Pandas 时,它也会这样做。

Thanks!

谢谢!

回答by ThunderFlash

You might not have installed setuptools correctly, or it may not be upgraded. Try this first

您可能没有正确安装 setuptools,或者它可能没有升级。先试试这个

pip install --upgrade setuptools

And then, try with pip, or sometimes pip2/3 also might work.

然后,尝试使用 pip,或者有时 pip2/3 也可能工作。

pip install matplotlib
pip2 install matplotlib

On another note, you should really try to search your error before you post a question, since this has happened before, Python pip install gives "Command "python setup.py egg_info" failed with error code 1"

另一方面,您真的应该在发布问题之前尝试搜索您的错误,因为这之前发生过,Python pip install 给出“命令“python setup.py egg_info”失败,错误代码为 1”