我通过下载 tar.gz 包并执行python setup.py install
. 但是我收到了这个错误
bash-3.2$ python
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import oauth2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named oauth2
>>>
oauth2 的路径在 PYTHONPATH 中(所以这不应该是问题),因为我将此行添加到 ~/.bashrc:
PYTHOHPATH=$PYTHONPATH:/Users/me/Downloads/oauth2-1.5.211/
但是,当我这样做时:
bash-3.2$ cd /System/Library/Frameworks/Python.framework/Versions/2.7/
bash-3.2$ ls
Extras Headers Mac Python Resources _CodeSignature bin include lib
bash-3.2$ Python
Python 2.7.1 (r271:86882M, Nov 30 2010, 09:39:13)
[GCC 4.0.1 (Apple Inc. build 5494)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import oauth2
>>>
它工作得很好。知道我应该如何安装 oauth2 以避免 ImportError frompython
吗?
P/S:这是python
命令的simlink
python -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7