# _*_ 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. 〖Linux〗Qt+gsoap开发客户端程序,服务端地址设定的字符串转换处理

    之所以写出来,是由于经常因为这个问题屡屡丢面子.. 一般情况下,QString转换成(char*),我们一般直接使用: char *str = qstr->text().toLatin1().d ...

  2. 判断URL是否支持断点续传?

    #python #xiaodeng #判断URL是否支持断点续传? import urllib2 req = urllib2.Request('http://ftp.ubuntu.com/') req ...

  3. 改变maven父子项目视图为树状

    完毕

  4. 速度挑战 - 2小时完成HTML5拼图小游戏

    概述 我用lufylegend.js开发了第一个HTML5小游戏——拼图游戏,还写了篇博文来炫耀一下:HTML5小游戏<智力大拼图>发布,挑战你的思维风暴. 详细 代码下载:http:// ...

  5. ubuntu发热问题的解决——显卡驱动的安装

    为了支持自由软件事业,本人作出了“一生中最有意义“的决定:将工作环境从Windows转移到Linux中来!于是装上了ubuntu-10.10,但是用了一小段时间后发现本本发热超大,于是Google百度 ...

  6. 【转】排名前十位的Linux发行版介绍

    Linux Distributions众多,据说有350个之多.distrowatch.com网站评出了排名前十位的Linux发行版.它们是:1.Ubuntu,当前最新版本是10.10:2.Fedor ...

  7. 在linux下安装并使用websocket

    前言 首先,对websocket要有一个简要的了解与认识 websocket是HTML5开始提供的一种浏览器与服务器进行全双工通讯的网络技术,属于应用层协议. 它基于TCP传输协议,并复用HTTP的握 ...

  8. 谈谈easyui datagrid 的数据加载(转)

    这篇文章只谈jQuery easyui datagrid 的数据加载,因为这也是大家谈论最多的内容.其实easyui datagrid加载数据只有两种方式:一种是ajax加载目标url返回的json数 ...

  9. 工作总结 Mapper.Map 映射 AutoMapper

    对象映射工具 //1.创建映射规则  ,第一个参数为源实体(Model),第二个为目标实体(DTO) Mapper.CreateMap<studentSource, studentPurpost ...

  10. PS_Form个性化复杂需求新增Menu并调用Request(案例)

    2014-06-01 Created By BaoXinjian