简体   繁体   English

无法将 matplotlib 安装到 pycharm

[英]Can't install matplotlib to pycharm

I have recently started to learn python programming using Python Crash Course.我最近开始使用 Python Crash Course 学习 Python 编程。 I am stuck as I can't get matplotlib to work in pycharm.我被卡住了,因为我无法让 matplotlib 在 pycharm 中工作。

I have pip installed.我已经安装了 pip。 I have installed matplotlib using pip via command prompt.我已经通过命令提示符使用 pip 安装了 matplotlib。

Now, when I open pycharm and go file->settings->project interpreter->download packages and find and press install for matplotlib, I get an error: Command "python setup.py egg_info" failed with error code 1 in C:\\Users\\Tony\\AppData\\Local\\Temp\\pip-install-f2h0rvbb\\matplotlib\\ .现在,当我打开 pycharm 并转到文件-> 设置-> 项目解释器-> 下载包并找到并按下 matplotlib 的安装时,出现错误:命令“python setup.py egg_info”在 C:\\ 中失败,错误代码为 1 Users\\Tony\\AppData\\Local\\Temp\\pip-install-f2h0rvbb\\matplotlib\\ 。 When installing on pycharm it says its using cached file from website I didn't download my matplotlib from.在 pycharm 上安装时,它说它使用来自网站的缓存文件,我没有从中下载我的 matplotlib。

I have tried "pip install matplotlib" from pycharm terminal and get the same error.我已经从 pycharm 终端尝试过“pip install matplotlib”并得到同样的错误。

I have tried typing "pip install matplotlib" from cmd and it does so and says its already satisfied.我试过从 cmd 输入“pip install matplotlib”,它这样做了,并说它已经满意了。

Any help or guidance would be appreciated, thanks.任何帮助或指导将不胜感激,谢谢。

Managed to get it to work by typing into pycharm terminal:通过输入 pycharm 终端设法让它工作:

pip install updates pip 安装更新

Then I went to file->settings->project interpreter-> then found pip via search and updated it again to be more sure.然后我去文件->设置->项目解释器->然后通过搜索找到pip并再次更新它以更确定。 Once pip version on left hand side of column in file->settings->project interpreter showed the version to be the newest 20.0.2 which was == to the right hand side(latest version) column it was 100% updated.一旦文件-> 设置-> 项目解释器中列左侧的 pip 版本显示版本是最新的 20.0.2,即 == 右侧(最新版本)列,它已 100% 更新。 This can be done also by pressing the upgrade button just above the 'show early releases' button which looks like an eye just to the right of the right hand side column when you have already clicked on the package.这也可以通过按下“显示早期版本”按钮正上方的升级按钮来完成,当您已经单击该软件包时,该按钮看起来就像右侧栏右侧的一只眼睛。

To finish I went file->settings->project interpreter-> found matplotlib and installed package successfully.最后我去文件->设置->项目解释器->找到matplotlib并成功安装包。

Overall I think that not having an up to date version of pip being used for pycharm and having to update the one specifically for use in pycharm is responsible not being able to install matplotlib.总的来说,我认为没有用于 pycharm 的最新版本的 pip 并且必须更新专门用于 pycharm 的 pip 是无法安装 matplotlib 的原因。 Although it could have also been due to having downloaded pip separately elsewhere on my system trying to solve this problem and when I have updated pip before from cmd.exe it didn't update the correct version of pip which I am using for Pycharm.虽然这也可能是由于在我的系统上的其他地方单独下载了 pip 试图解决这个问题,当我之前从 cmd.exe 更新 pip 时,它没有更新我用于 Pycharm 的正确版本的 pip。

虽然回答有点晚,但将 python 的版本从3.8更改为3.7对我有用。

Other way this worked for me.其他方式这对我有用。

Check for pip version if it's latest the downgrade it and then install matplotlib检查 pip 版本是否是最新的,将其降级,然后安装 matplotlib

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM