0

I am using Windows 7. I have installed Python 3.4 and Metmatplotlib.

I have tried the below code

from pylab import *
plot([1,2,3])
show()

But i am getting the follwoign error

Traceback (most recent call last):
  File "E:/Work/Python/Training/Samples.py", line 1, in <module>
    from pylab import *
  File "C:\Python34\lib\site-packages\pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "C:\Python34\lib\site-packages\matplotlib\__init__.py", line 169, in <module>
    from urllib2 import urlopen
ImportError: No module named 'urllib2'

I have searched for the package urllib2 but not seems to be find it.

Can any one help me

Thanks,

backtrack
  • 7,996
  • 5
  • 52
  • 99
  • `urllib2` was merged into `urllib` in Python 3. http://stackoverflow.com/questions/6594620/python-3-2-unable-to-import-urllib2-importerror-no-module-named-urllib2 and http://www.python.org/dev/peps/pep-3108/#urllib-package – Cory Kramer Nov 12 '14 at 14:10
  • Thank you for the comment.Can you please tell me why there was an above error – backtrack Nov 12 '14 at 14:12

1 Answers1

0

The urllib2 module has been split across several modules in Python 3 named urllib.request and urllib.error. The 2to3 tool will automatically adapt imports when converting your sources to Python 3.

https://docs.python.org/2/library/urllib2.html

Pandiyan Cool
  • 6,381
  • 8
  • 51
  • 87