I ran into an issue running pip from within a virtualenv on Windows.
The solution was to add a line to the end of Scripts\activate.bat:
SET PYTHONPATH=%PYTHONPATH%;C:\Python27\DLLs;
_________
C:\Users\Administrator\flask\BASEFLASKAPP>ls
README.md flask requirements.txt
C:\Users\Administrator\flask\BASEFLASKAPP>virtualenv .
New python executable in .\Scripts\python.exe
Installing setuptools, pip…done.
C:\Users\Administrator\flask\BASEFLASKAPP>pip
Usage:
pip
…
C:\Users\Administrator\flask\BASEFLASKAPP>Scripts\activate.bat
(BASEFLASKAPP) C:\Users\Administrator\flask\BASEFLASKAPP>pip
Traceback (most recent call last):
File “C:\Python27\Lib\runpy.py”, line 162, in _run_module_as_main
“__main__”, fname, loader, pkg_name)
File “C:\Python27\Lib\runpy.py”, line 72, in _run_code
exec code in run_globals
File “C:\Users\Administrator\flask\BASEFLASKAPP\Scripts\pip.exe\__main__.py”, line 5, in
File “C:\Users\Administrator\flask\BASEFLASKAPP\lib\site-packages\pip\__init__.py”, line 9, in
from pip.log import logger
File “C:\Users\Administrator\flask\BASEFLASKAPP\lib\site-packages\pip\log.py”, line 8, in
from pip import backwardcompat
File “C:\Users\Administrator\flask\BASEFLASKAPP\lib\site-packages\pip\backwardcompat\__init__.py”, line 66, in
from urllib2 import URLError, HTTPError
File “C:\Python27\Lib\urllib2.py”, line 94, in
import httplib
File “C:\Python27\Lib\httplib.py”, line 71, in
import socket
File “C:\Python27\Lib\socket.py”, line 47, in
import _socket
ImportError: No module named _socket
(BASEFLASKAPP) C:\Users\Administrator\flask\BASEFLASKAPP>notepad Scripts\activate.bat
**Add to the end: SET PYTHONPATH=%PYTHONPATH%;C:\Python27\DLLs;
(BASEFLASKAPP) C:\Users\Administrator\flask\BASEFLASKAPP>deactivate
C:\Users\Administrator\flask\BASEFLASKAPP>Scripts\activate.bat
(BASEFLASKAPP) C:\Users\Administrator\flask\BASEFLASKAPP>pip
Usage:
pip
…
(BASEFLASKAPP) C:\Users\Administrator\flask\BASEFLASKAPP>ls
Include Lib README.md Scripts cmd flask ls pip requirements.txt virtualenv
(BASEFLASKAPP) C:\Users\Administrator\flask\BASEFLASKAPP>pip install -r requirements.txt
Downloading/unpacking Flask==0.10.1 (from -r requirements.txt (line 1))
…