我正在尝试安装特定的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/
答案 0 :(得分:2)
目录的名称接缝为 bitly_api 。
python中的import bitly_api