title: pip does not honor PIP_INDEX_URL with sudo
body: <p>According to the <a href="https://pypi.python.org/pypi/pypiserver#configuring-pip-easy-install" rel="noreferrer">doc</a> I can direct pip to use my private pypi repository instead of the official one:</p>
  
  <pre><code>For pip this can be done by setting the environment variable PIP_INDEX_URL in your .bashrc/.profile/.zshrc:
  export PIP_INDEX_URL=http://localhost:8080/simple/
  </code></pre>
  
  <p>So I added my private repository(e.g.,  <code>http://pypi.mycompany.com/simple</code> ) into <code>/etc/profile</code> on my Debian server. However pip still raises error:</p>
  
  <pre><code>john@server:~$ sudo pip install ipython
  Downloading ...
      Cannot fetch index base URL https://pypi.python.org/simple/
      ...
  </code></pre>
  
  <p>Looks like pip ignores the environment variable <code>PIP_INDEX_URL</code> I've set. Why?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Following @Ivo's direction, I found my Python didn't see the variable at all:</p>
  
  <pre><code>john@server:~$ sudo python -c "import os; print(os.getenv('PIP_INDEX_URL'))"
  None
  </code></pre>