【问题标题】:How to install matplotlib? [python]如何安装matplotlib? [Python]
【发布时间】:2018-11-12 07:47:35
【问题描述】:

我想通过 pip 安装 matplotlib 时遇到问题:
我做到了:

$ sudo pip install matplotlib

输出:

Requirement already satisfied: matplotlib in /usr/lib/python2.7/dist-packages (1.5.1)
launchpadlib 1.10.3 requires testresources, which is not installed.
paramiko 2.4.1 has requirement cryptography>=1.5, but you'll have cryptography 1.2.3 which is incompatible.

然后我做了:

$ sudo pip install cryptography

输出:与上述相同的错误。

部分代码:

import sys
print(sys.version)
import matplotlib.pyplot as plt

输出:

2.7.12 (default, Dec  4 2017, 14:50:18) 
Traceback (most recent call last):
[GCC 5.4.0 20160609]

import matplotlib.pyplot as plt
ImportError: No module named matplotlib.pyplot

我该怎么办?

提前致谢。

【问题讨论】:

  • 你试过sudo pip install -r matplotlib吗?
  • 尝试使用pip install matplotlib --upgrade升级包
  • @AliYılmaz 我更新了我的问题。
  • 您正在安装到 python 2。您确定您运行的是 python 2 而不是 3?试试pip3 install matplotlib。我没有大量使用 Linux,但 sudo 没有安装到可能与特定用户版本不同的 Python 版本?
  • @PRMoureu 我做到了,但问题没有解决。

标签: python ubuntu matplotlib cryptography pip


【解决方案1】:

我发现了问题:

我使用 Pycharm IDE 并创建一个新项目并选择 "New environment using Vitualenv" 选项而不是 "Existing interpreter",然后我将其更改为 "Existing interpreter" 选项,这是正确的。


感谢我问题中的所有 cmets(更新 matplotlib 并关注 Python 版本)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-26
    • 1970-01-01
    • 2022-01-24
    • 1970-01-01
    • 2021-02-07
    • 2012-05-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多