首页 > 解决方案 > PyCharm 找不到现有的 Matplotlib 安装或安装新的

问题描述

我正在尝试使用使用 Matplotlib 图的 PyCharm 运行和调试 Python 脚本。但是我也不能这样做,因为 PyCharm 找不到我现有的 Matplotlib 安装,并且当我尝试通过设置/包管理器界面安装 Matplotlib 时无法下载和安装它自己的版本。

但是,我已经在我的计算机上安装了 Matplotlib,当我通过终端运行脚本时,一切正常。

所以我的问题是,我怎么能:

  1. 通过 PyCharm 成功安装 Matplotlib 或
  2. 将 PyCharm 指向我现有的 Matplotlib 安装

系统版本

通过 PyCharm 安装 Matplotlib 时出错

Collecting matplotlib==3.0.2
  Could not fetch URL https://pypi.org/simple/matplotlib/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/matplotlib/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/matplotlib/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/matplotlib/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/matplotlib/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/matplotlib/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/matplotlib/
  Could not find a version that satisfies the requirement matplotlib==3.0.2 (from versions: )
No matching distribution found for matplotlib==3.0.2
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

标签: python-3.xsslmatplotlibpippycharm

解决方案


Ubuntu 14.04 不包括 OpenSSL 1.0.2 或更高版本,Python 3.7 现在需要它。这意味着不会内置 python 的 ssl 模块。没有 ssl 模块 pip 无法从存储库下载包。

如果您将pycharms配置为使用终端将使用的系统版本的 python (3.4),那么您应该可以得到 matplotlib。

我的建议是升级到 16.04 或更高版本。


推荐阅读