【问题标题】:Unable to import matplotlib pyplot无法导入 matplotlib pyplot
【发布时间】:2017-07-16 10:24:18
【问题描述】:

我无法导入 pyplot。如何解决错误?
最好的

>>> from matplotlib import pyplot
Jul 16 12:49:46  Python[35767] <Error>: Set a breakpoint at CGSLogError to catch errors as they are logged.
Jul 16 12:49:46  Python[35767] <Error>: On-demand launch of the Window Server is allowed for root user only.
Jul 16 12:49:46  Python[35767] <Warning>: CGSLookupServerRootPort: Failed to look up the port for "com.apple.windowserver.active" (268435459)
Jul 16 12:49:46  Python[35767] <Error>: On-demand launch of the Window Server is allowed for root user only.
Jul 16 12:49:46  Python[35767] <Warning>: CGSLookupServerRootPort: Failed to look up the port for "com.apple.windowserver.active" (268435459)
Jul 16 12:49:46  Python[35767] <Error>: This user is not allowed access to the window system right now.
_RegisterApplication(), unable to get application ASN from launchservicesd, and this application requires an ASN, so aborting.  error=#-1.
Abort trap: 6

【问题讨论】:

    标签: python python-3.x matplotlib


    【解决方案1】:

    为了使用这个库,首先需要安装它。 可以从official site安装。

    在 Ubuntu 中可以通过 apt-get 获取它:

    sudo apt-get install python-matplotlib
    

    在 windows 中,对于标准 Python 安装,使用 pip 安装 matplotlib:

    python -m pip install -U pip setuptools
    python -m pip install matplotlib
    

    【讨论】:

      【解决方案2】:

      你没有正确安装 你应该通过 pip 安装它 python -m pip install -u pip setuptools python -m pip 安装 matplotlib

      (此方法仅适用于windows)

      【讨论】:

        猜你喜欢
        • 2016-06-10
        • 1970-01-01
        • 2015-12-02
        • 2015-10-16
        • 1970-01-01
        • 2018-05-13
        • 2021-02-09
        • 1970-01-01
        相关资源
        最近更新 更多