pip 环境问题
Que 0x01 ImportError: cannot import name 'main'
更新 pip 10 之后,使用 pip 会报如下错误:
ImportError: cannot import name 'main'
具体解决方案为修改 /usr/bin/pip
,内容如下:
#!/usr/bin/python
# GENERATED BY DEBIAN
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal import main as _main
# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(_main())
Que 0x02 ImportError: No module named setuptools
要使用 pip 缺少模块 setuptools,解决方案为手动安装
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py install
在具体操作过程中,使用 wget 下载目标文件的时候会报 403 的错误,直接使用浏览器下载即可。