Cannot import urllib in Python
<p>I would like to import <code>urllib</code> to use the function '<code>request</code>'. However, I encountered an error when trying to download via Pycharm: </p>

<blockquote>
  <p>"Could not find a version that satisfies the requirement urllib (from versions: ) No matching distribution found for urllib" </p>
</blockquote>

<p>I tried <code>pip install urllib</code> but still had the same error. I am using Python 2.7.11. Really appreciate any help</p>

<p>A few things:</p>

<ol>
<li>As metioned in the comments, <code>urllib</code> is not installed through <code>pip</code>, it is part of the standard library, so you can just do <code>import urllib</code> without installation. </li>
<li>Python 3.x has a <a href="https://docs.python.org/3/library/urllib.request.html" rel="nofollow"><code>urllib.request</code></a> module, but Python 2.x does not, as far as I know.</li>
<li><p>The functionality that you are looking for from <code>urllib.request</code> is most likely contained in <a href="https://docs.python.org/2/library/urllib2.html#module-urllib2" rel="nofollow"><code>urllib2</code></a> (which is also part of the standard library), but you might be even better off using <a href="http://docs.python-requests.org/en/master/" rel="nofollow"><code>requests</code></a>, which probably does need to be installed through <code>pip</code> in your case:</p>

<pre><code>pip install requests
</code></pre>

<p>In fact, the <code>urllib2</code> documentation itself recommends that you use the <code>requests</code> library "for a higher-level HTTP client interface" - but I am not sure what you wish to do, so it is hard to say what would be best for your particular use case. </p></li>
</ol>

python python-2.7