我是蟒蛇菜鸟。已经安装了 virtualenv 和 pip,在我看来一切正常,但是当尝试导入通过 pip 安装的包时,python 找不到它们。我在 OS X 上并且有系统 python 2.6 in ,所以通过包安装程序/usr/bin
安装了 2.7 。在安装 pip 和 virtualenv 时,我通过将 PATH 设置为first/usr/local/bin
来确保正在使用 2.7 python 。/usr/local/bin
(pysite)sbeam@pris ~/Sites]$ pip freeze
Django==1.4
Markdown==2.1.1
psycopg2==2.4.5
wsgiref==0.1.2
(pysite)sbeam@pris ~/Sites]$ echo $PYTHONPATH
(pysite)sbeam@pris ~/Sites]$ which python
/Users/sbeam/.virtualenvs/pysite/bin/python
(pysite)sbeam@pris ~/Sites]$ env | grep VIRTUAL
VIRTUALENVWRAPPER_PROJECT_FILENAME=.project
VIRTUAL_ENV=/Users/sbeam/.virtualenvs/pysite
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
VIRTUALENVWRAPPER_HOOK_DIR=/Users/sbeam/.virtualenvs
VIRTUALENVWRAPPER_LOG_DIR=/Users/sbeam/.virtualenvs
(pysite)sbeam@pris ~/Sites]$ python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> from pprint import pprint as pp
>>> pp(sys.path)
['',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.27-py2.7.egg',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-0.7.2-py2.7.egg',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages']
>>> import markdown
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named markdown