Anaconda2 ImportError:没有名为matplotlib.pylab的模块

时间:2018-11-21 12:48:47

标签: python eclipse python-2.7 matplotlib importerror

在Eclipse中,我尝试导入“ matplotlib”,但这没有用。

Traceback (most recent call last):
File "C:\Users\Hunter-\Desktop\A_Cognitive\neural_network\step_function.py", 
line 2, in <module>
import matplotlib.pylab as plt
ImportError: No module named matplotlib.pylab

mycode在下面

import numpy as np
import matplotlib.pylab as plt
def step_funtion(x):
return np.array(x>0,dtype=np.int)
x=np.arange(-5.0,5.0,0.1)
y=step_funtion(x)
plt.plot(x,y)
plt.ylim(-0.1,1.1)
plt.show

※通过Windows cmd“ WHERE”进行了检查,最后得到了matplotlib文件存在的结果。↓ >在/ r C:\ ProgramData \ Anaconda2 matplotlib。* _

C:\ProgramData\Anaconda2\pkgs\anaconda-navigator-1.9.2-py27_0\Lib\site- 
  packages\anaconda_navigator\static\images\logos\matplotlib.png
C:\ProgramData\Anaconda2\pkgs\matplotlib-2.2.3-py27h263d877_0\Lib\site- 
  packages\matplotlib\mpl-data\images\matplotlib.pdf
C:\ProgramData\Anaconda2\pkgs\matplotlib-2.2.3-py27h263d877_0\Lib\site- 
  packages\matplotlib\mpl-data\images\matplotlib.png
C:\ProgramData\Anaconda2\pkgs\matplotlib-2.2.3-py27h263d877_0\Lib\site- 
  packages\matplotlib\mpl-data\images\matplotlib.ppm
C:\ProgramData\Anaconda2\pkgs\matplotlib-2.2.3-py27h263d877_0\Lib\site- 
  packages\matplotlib\mpl-data\images\matplotlib.svg
C:\ProgramData\Anaconda2\pkgs\spyder-3.3.1-py27_1\Lib\site- 
  packages\spyder\images\matplotlib.png

1 个答案:

答案 0 :(得分:0)

我想你的意思是

import matplotlib.pyplot as plt