我正在尝试安装一个特定的 python 库(https://github.com/bitly/bitly-api-python/)。
推荐的方法是使用 pip,但是 pip 在我大学的认证代理系统后面不起作用。所以我正在尝试手动安装它。它有一个 setup.py 文件。我试着做sudo python setup.py install
,它说:
running install
Checking .pth file support in /usr/local/lib/python2.7/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth files
running bdist_egg
running egg_info
writing bitly_api.egg-info/PKG-INFO
writing top-level names to bitly_api.egg-info/top_level.txt
writing dependency_links to bitly_api.egg-info/dependency_links.txt
reading manifest file 'bitly_api.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'bitly_api.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/bitly_api
copying build/lib.linux-x86_64-2.7/bitly_api/__init__.py -> build/bdist.linux-x86_64/egg/bitly_api
copying build/lib.linux-x86_64-2.7/bitly_api/bitly_http.py -> build/bdist.linux-x86_64/egg/bitly_api
copying build/lib.linux-x86_64-2.7/bitly_api/bitly_api.py -> build/bdist.linux-x86_64/egg/bitly_api
byte-compiling build/bdist.linux-x86_64/egg/bitly_api/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitly_api/bitly_http.py to bitly_http.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitly_api/bitly_api.py to bitly_api.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying bitly_api.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying bitly_api.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying bitly_api.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying bitly_api.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying bitly_api.egg-info/zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
creating 'dist/bitly_api-0.2-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing bitly_api-0.2-py2.7.egg
removing '/usr/local/lib/python2.7/dist-packages/bitly_api-0.2-py2.7.egg' (and everything under it)
creating /usr/local/lib/python2.7/dist-packages/bitly_api-0.2-py2.7.egg
Extracting bitly_api-0.2-py2.7.egg to /usr/local/lib/python2.7/dist-packages
bitly-api 0.2 is already the active version in easy-install.pth
Installed /usr/local/lib/python2.7/dist-packages/bitly_api-0.2-py2.7.egg
Processing dependencies for bitly-api==0.2
Finished processing dependencies for bitly-api==0.2
这看起来像一个成功的安装。但是,如果我说python
然后import bitlyapi
,python 说ImportError: No module named bitlyapi
。
我究竟做错了什么?
顺便说一句,我正在关注本指南: http: //www.pythonforbeginners.com/code-snippets-source-code/bitly-shortener-with-python/