# _*_ 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. JavaScript-实现滚动条

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. java 运行时环境和编译器环境

    必须要保证运行环境高于编译环境 1.编译器的环境设置 单击项目右键-> Properties -> Java Compiler -> 5或6 如果编译器的环境高于运行时环境会报错. ...

  3. Ubuntu14.04 mount远程服务器上的目录

    备忘用. 一,远程服务器设置: 1,在/etc/exports中添加如下配置: /home/xxx *(insecure,rw,sync,no_root_squash,anonuid=123,anon ...

  4. iOS7 UIWebview加载进度条实现

    不同于WKWebview,wk是有自己的加载进度值的,我们可以直接通过kvo检测到,并显示到进度条内. 但如果我们为了适配ios7,只能使用UIWebview了,这里的加载进度,就比较尴尬了 所以我们 ...

  5. EditPlus正则表达式中英文详解(附常用事例操作)

    http://www.cnblogs.com/JustinYoung/articles/editplus_regular_expression.html EditPlus正则表达式中英文详解 \t T ...

  6. java集合框架03——ArrayList和源码分析

    最近忙着替公司招人好久没写了,荒废了不好意思. 上一章学习了Collection的架构,并阅读了部分源码,这一章开始,我们将对Collection的具体实现进行详细学习.首先学习List.而Array ...

  7. MySQL 获取某一个分类ID的所有父或子分类查询结果

    创建一个自定义函数: ; DELIMITER $$ USE `dressv_website`$$ DROP FUNCTION IF EXISTS `fn_QueryRelation`$$ CREATE ...

  8. mysql 慢查询日志,灾难日志恢复,错误日志

    灾难日志 记录了所有的DDL(Create.Drop和Alter)和DML(insert.update.delete_的语句,但不包括查询的语句 打开mysql.ini 找到Binary Loggin ...

  9. mysql 查看是否被锁

    SHOW OPEN TABLES FROM huahua

  10. Mac升级bash到最新版本

    mac自带的bash为3.2版本,而最新的bash是4.9,需要升级了,才能支持关联数组等新特性. 1.brew install bash 2.安装到/usr/local/bin/bash里面.可以通 ...