在下载安装一个python工具时提示报错No module named setuptools
[[email protected] supervisor-3.3.0]$ sudo python setup.py install
Traceback (most recent call last):
File "setup.py", line 32, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools
于是去下载setuptools工具,但遇到报错 ERROR 403: SSL is required.
[[email protected] ~]# wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
--2017-11-03 11:20:16-- http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
Resolving pypi.python.org... 151.101.72.223, 2a04:4e42:11::223
Connecting to pypi.python.org|151.101.72.223|:80... connected.
HTTP request sent, awaiting response... 403 SSL is required
2017-11-03 11:20:16 ERROR 403: SSL is required.
这时可能你会把它认为是要进行ssl证书检查的错误,可能会去尝试下面的命令,但发现仍然会报错。另外wget在安装的时候也有一项配置:./configure --with-ssl=openssl,这个配置会影响wget是否支持获取https的内容。
sudo wget --no-check-certificate http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
实际这个ERROR 403: SSL is required报错只是要求请求的URL一定要是https, 请求方自己没有做301转向处理。所以使用以下的命令即可。然后安装setuptools
sudo wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar -xvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
sudo python setup.py build
sudo python setup.py install
.....
#如下标志安装成功
Installed /usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11
#查看文件
[[email protected] ~]$ ll /usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg
-rw-r--r-- 1 root root 333591 Nov 3 11:31 /usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg