【问题标题】:Python installation error no matching distribution found for pyplotPython安装错误找不到pyplot的匹配分布
【发布时间】:2015-10-17 17:25:23
【问题描述】:

我正在尝试运行这个程序

import matplotlib.pyplot as plt
import numpy

plt.plot([1, 2, 3],[5, 7, 4])
plt.show()

我收到一条错误消息: ImportError:没有名为 pyplot 的模块

我已经在 Windows 8 64 位 Python 2.7 上安装了 matplotlib,使用来自 bash 的 pip 命令,我也对其进行了更新,结果收到了这条消息:

Aneta@AKZ-5K-Computer:~$ C:/Python27/Scripts/pip install --upgrade matplotlib
Requirement already up-to-date: matplotlib in c:\python27\lib\site-packages
Requirement already up-to-date: pyparsing>=1.5.6 in c:\python27\lib\site-packages\pyparsing-2.0.3-py2.7-win32.egg (from matplotlib)
Requirement already up-to-date: numpy>=1.6 in c:\python27\lib\site-packages (from matplotlib)
Requirement already up-to-date: pytz in c:\python27\lib\site-packages\pytz-2015.6-py2.7.egg (from matplotlib)
Requirement already up-to-date: python-dateutil in c:\python27\lib\site-packages\python_dateutil-2.4.2-py2.7.egg (from matplotlib)
Requirement already up-to-date: six>=1.4 in c:\python27\lib\site-packages\six-1.10.0-py2.7.egg (from matplotlib)

当我尝试安装 pyplot 时,我得到了这个按摩:

Aneta@AKZ-5K-Computer:~$ C:/Python27/Scripts/pip install pyplot
Collecting pyplot
  Could not find a version that satisfies the requirement pyplot (from versions: )
No matching distribution found for pyplot

如果有人知道如何安装 pyplot 以及为什么我的发行版不匹配,感谢您的帮助。

【问题讨论】:

  • 我从一个 wheel 文件安装 matplotlib,因为在 Windows 上我从来没有能够从 pip 成功安装 64 位版本。所以尝试下载 .whl 文件并从中安装。

标签: python matplotlib


【解决方案1】:

如果你尝试

pip install matplotlib

失败了,试试

pip install --upgrade matplotlib

您可能已经预装了该软件包。

【讨论】:

    【解决方案2】:

    尝试从 here 重新安装 matplotlib。如果您使用的是 64 位计算机(我也是),这并不重要。重要的是您安装了哪个版本的 Python?如果您安装了 32 位(推荐因为它更容易处理),那么您仍然安装 32 位版本的模块。

    我链接到您的网站显示了 matplotlib 的必备模块,因此请确保您也安装了这些模块。

    【讨论】:

    • 发布了很棒的资源
    【解决方案3】:

    或者你可以做的就是尝试 pip install matplotlib。 然后导入 matplotlib.pyplot 以获取 pyplot 数据。 matplotlib 是一个包含 pyplot 的模块,因此您可以轻松访问 pyplot。

    【讨论】:

    • 这是重点:pip install matplotlib 这样你就可以import matplotlib.pyplot as pltimport pylab
    猜你喜欢
    • 2018-04-12
    • 1970-01-01
    • 2019-04-08
    • 2020-09-19
    • 2019-01-31
    • 2018-02-08
    • 2021-10-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多