Can't install urllib2 for python 2.7

Anna Timko picture Anna Timko · Jan 14, 2017 · Viewed 69.5k times · Source

I try to install module urllib2 for python 2.7 (I as usual use command pip install), but have an error

No matching distribution found for urllib2..

What should I do?

Answer

Vidya Sagar picture Vidya Sagar · Jan 16, 2017

You don't need to pip install urllib/urllib2

In Python 2.7 , urllib and urllib2 comes with python .

import urllib 

OR

import urllib2 

In Python 3+ , urllib2 is replaced with urllib.request.

 import urllib.request  as urllib2