# _*_ coding:utf-8 _*_
import numpy as np
import matplotlib.pyplot as plt x = np.arange(-5, 5, 0.1)
y = np.sin(x)
plt.plot(x, y)
plt.show()

这里插入一个可能会碰到的问题:

I am trying to import matplotlib like so:

import matplotlib.pyplot as plt
For this I have installed matplotlib using. python -m pip install -U pip setuptools
python -m pip install matplotlib
Although the basic_example.py from the examples worked, it suddenly stopped running along with all other files with matplotlib giving me the below error: File "matplotlib.py", line 2, in <module>
import matplotlib.pyplot as plt # pyplot module.
ImportError: No module named pyplot`
I tried to check if the module is still there, and it seems to be. What could be possibly wrong? Requirement already satisfied: matplotlib in c:\python27\lib\site-packages
Requirement already satisfied: numpy>=1.6 in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: python-dateutil in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: cycler in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,>=1.5.6 in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: pytz in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: six>=1.5 in c:\python27\lib\site-packages (from python-dateuti

简单的说就是,安装了模块,但是出现模块导入错误。

看看回答:

Python 2.7 tries to find modules in the current working directory first, before
going into the installed packages, so because you named your test file "matplotlib.py",
it will interpret it as the matplotlib package. Rename your test file to something else, and it should be fine

是的,检查一下你的文件名是不是跟导入的模块名重复了。。。。

使用matplot做图--sin图像的更多相关文章

  1. 从视频文件中读入数据-->将数据转换为灰度图-->对图像做canny边缘检测-->将这三个结构显示在一个图像中

    //从视频文件中读入数据-->将数据转换为灰度图-->对图像做canny边缘检测-->将这三个结构显示在一个图像中 //作者:sandy //时间:2015-10-10 #inclu ...

  2. 图像切割—基于图的图像切割(Graph-Based Image Segmentation)

     图像切割-基于图的图像切割(Graph-Based Image Segmentation) Reference: Efficient Graph-Based Image Segmentation ...

  3. QiniuUpload- 一个方便用七牛做图床然后插入markdown的小工具

    最近一段时间有用markdown做笔记,其他都好,但是markdown插入图片挺麻烦的,特别是想截图之后直接插入的时候.需要首先把图片保存了,然后还要上传到一个地方生成链接才能插入.如果有个工具可以直 ...

  4. python做图笔记

    1. 工具选择 了解了基本python,rodeo,anaconda套件这三种工具. (1)基本python,下载安装python的最新版(目前是python3.7).注意要使用安装版.安装好后,一般 ...

  5. win10 uwp 使用 asp dotnet core 做图床服务器客户端

    原文 win10 uwp 使用 asp dotnet core 做图床服务器客户端 本文告诉大家如何在 UWP 做客户端和 asp dotnet core 做服务器端来做一个图床工具   服务器端 从 ...

  6. matplotlib 做图通过弹出窗口展示 spyder

    tools =>preferences=>Ipython console=>Graphics Graphics backend 中Backend 由Inline改为 Automati ...

  7. 用 GraphScope 像 NetworkX 一样做图分析

    NetworkX 是 Python 上最常用的图分析包,GraphScoep 兼容 NetworkX 接口.本文中我们将分享如何用 GraphScope 像 NetworkX 一样在(大)图上进行分析 ...

  8. 跟我学Python图像处理丨基于灰度三维图的图像顶帽运算和黑帽运算

    摘要:本篇文章结合灰度三维图像讲解图像顶帽运算和图像黑猫运算,通过Python调用OpenCV函数实现. 本文分享自华为云社区<[Python图像处理] 十三.基于灰度三维图的图像顶帽运算和黑帽 ...

  9. 矢量做图组件OTGisX的使用(类似Mapbase)

    一:组件添加到工具栏 要在应用程序中应用OTGisX控件,首先要把所下载的OTGisX组件添加到.Net工程中.并将其添加到工具箱托盘中.添加方式为:在工具箱上单击右键,选择“选择项”,会出现“选择工 ...

随机推荐

  1. DB2的认证和授权

    DB2 的安全性由两方面组成:认证和授权 1.认证 认证就是系统验证用户身份的过程.说的简单点,就是验证用户名和密码,因为DB2用户同时也是操作系统用户,所以,首先必须得到操作系统的认可.在默认情况下 ...

  2. java 新创建的类要重写的方法

    重写toString方法,可以控制println打印的结构. 如果需要往hashSet或者HashMap中存,需要重写hashCode和equals方法,因为hashSet执行添加,以对象为参数删除, ...

  3. Fiddler 中请求时间的显示列

    在Tool bar上面找到 Rules->CustomRules 在class Handlers{   里面添加 //----------------------------显示请求时间,显示毫 ...

  4. 一些很经典的JavaScript的问题

    1.作用域 (function() { var a = b = 5; })(); console.log(b); 输出:5 陷阱是,在函数表达式中有两个赋值,但a是用关键字var 来声明的,这意味着a ...

  5. url-pattern / /*匹配

    http://hi.baidu.com/atell/item/522112d3db45081fd90e44e1 struts2中配置为 <url-pattern>/*</url-pa ...

  6. Makefile 中:= ?= += =的区别【转】

    转自:http://www.cnblogs.com/wanqieddy/archive/2011/09/21/2184257.html 在Makefile中我们经常看到 = := ?= +=这几个赋值 ...

  7. MySQL C 客户端的内存泄漏问题

    我们的一个服务器软件在线上环境运行时出现了内存缓慢增长的问题. 用valgrind测试 MySQL的C客户端mysqlclient发现,它在正常的使用中会被valgrind报出存在内存泄漏. 1 正常 ...

  8. Bugtags 让你的 APP 测试轻松、上线安心

    Bug 管理系统再进化 Bugtags 的创业团队,在过去几年,做了很多方向的尝试——没错,是开发了很多 APP. 每一轮迭代,都会被繁琐的 APP 测试困扰:无休止的截屏上传电脑,无数次的开发与测试 ...

  9. Google C++单元测试框架

    一.概述 Google C++单元测试框架(简称Gtest),可在多个平台上使用(包括Linux, Mac OS X, Windows, Cygwin和Symbian),它提供了丰富的断言.致命和非致 ...

  10. RabbitMQ消息队列(五):Routing 消息路由 2[原]

    上一篇文章使用的是Direct的Exchange,但是没有指定Queue的名字,这样只能是先运行Consumer之后,Producer在运行发消息Consumer才能收到,否则先运行Producer发 ...