python安装途中遇到的问题和解决方法
一、setuptools安装错误:RuntimeError: Compression requires the (missing) zlib module
1. 描述
搞了个腾讯云的服务器,闲在手上没事准备当个测试机用用,写写代码什么的。然后按照之前写的文章安装了python2.7
,安装的中途出现了一个错误:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
running install
running bdist_egg
running egg_info
writing requirements to setuptools.egg-info/requires.txt
writing setuptools.egg-info/PKG-INFO
writing top-level names to setuptools.egg-info/top_level.txt
writing dependency_links to setuptools.egg-info/dependency_links.txt
writing entry points to setuptools.egg-info/entry_points.txt
reading manifest file "setuptools.egg-info/SOURCES.txt"
reading manifest template "MANIFEST.in"
warning: no files found matching "*" under directory "setuptools/_vendor"
writing manifest file "setuptools.egg-info/SOURCES.txt"
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying setuptools.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
creating "dist/setuptools-36.6.0-py2.7.egg" and adding "build/bdist.linux-x86_64/egg" to it
Traceback (most recent call last):
File "setup.py", line 188, in <module>
dist = setuptools.setup(**setup_params)
File "/usr/local/python27/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/local/python27/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/local/python27/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/data/setuptools-36.6.0/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/data/setuptools-36.6.0/setuptools/command/install.py", line 109, in do_egg_install
self.run_command("bdist_egg")
File "/usr/local/python27/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/local/python27/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/data/setuptools-36.6.0/setuptools/command/bdist_egg.py", line 231, in run
dry_run=self.dry_run, mode=self.gen_header())
File "/data/setuptools-36.6.0/setuptools/command/bdist_egg.py", line 473, in make_zipfile
z = zipfile.ZipFile(zip_filename, mode, compression=compression)
File "/usr/local/python27/lib/python2.7/zipfile.py", line 736, in __init__
"Compression requires the (missing) zlib module"
RuntimeError: Compression requires the (missing) zlib module
|
其实错误一眼就能看出是缺少了zlib
库,然后使用yum install zlib zlib-devel
安装了库之后python setup.py install
发现还是一样报错。
2. 解决方法
装好zlib
相关库之后把把python
重新安装一遍,进入到源码目录:
1
2
|
yum install zlib zlib-devel
make && make install
|
二、setuptools错误:pkg_resources.DistributionNotFound: The "distribute==0.6.10" distribution was not found and is required by the application [2017-10-21添加]
1. 描述
安装完setuptools准备使用时报错:
1
2
3
4
5
6
7
8
9
10
|
Traceback (most recent call last):
File "/usr/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3142, in <module>
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3126, in _call_aside
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3155, in _initialize_master_working_set
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 666, in _build_master
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 679, in _build_from_requirements
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 867, in resolve
pkg_resources.DistributionNotFound: The "distribute==0.6.10" distribution was not found and is required by the application
|
2. 解决方法
缺少distribute
模块,使用pip
安装也装不上,需要在官网下载源码安装。
1
2
3
4
|
wget https://pypi.python.org/packages/source/d/distribute/distribute-0.6.10.tar.gz
tar -zxvf distribute-0.6.10.tar.gz
cd distribute-0.6.10
python setup.py install
|
三、pip报错:pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. [2017-10-21添加]
1. 错误描述
使用pip
安装shadowsocks
的时候报错:
1
2
3
4
5
|
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting shadowsocks
Could not fetch URL https://pypi.python.org/simple/shadowsocks/: There was a problem confirming the ssl certificate: Can"t connect to HTTPS URL because the SSL module is not available. - skipping
Could not find a version that satisfies the requirement shadowsocks (from versions: )
No matching distribution found for shadowsocks
|
2. 解决方法
系统缺少openssl-devel
包,使用yum install openssl-devel
安装。
然后重新安装python
:进入python
源码目录,make && make install
,解决。