1、fadora24安装Python2.7
1 [[email protected] ~]# python 2 bash: python: 未找到命令... 3 安装软件包“python”以提供命令“python”? [N/y] n 4 5 wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz 6 7 tar xf Python-2.7.12.tgz 8 9 cd Python-2.7.12 10 11 ./configura 12 13 make 14 15 make install
2、安装settools包,pip包
1 creating ‘dist/setuptools-25.1.6-py2.7.egg‘ and adding ‘build/bdist.linux-x86_64/egg‘ to it 2 Traceback (most recent call last): 3 File "setup.py", line 194, in <module> 4 dist = setuptools.setup(**setup_params) 5 File "/usr/local/lib/python2.7/distutils/core.py", line 151, in setup 6 dist.run_commands() 7 File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands 8 self.run_command(cmd) 9 File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command 10 cmd_obj.run() 11 File "/software/setuptools-25.1.6/setuptools/command/install.py", line 67, in run 12 self.do_egg_install() 13 File "/software/setuptools-25.1.6/setuptools/command/install.py", line 109, in do_egg_install 14 self.run_command(‘bdist_egg‘) 15 File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command 16 self.distribution.run_command(command) 17 File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command 18 cmd_obj.run() 19 File "/software/setuptools-25.1.6/setuptools/command/bdist_egg.py", line 223, in run 20 dry_run=self.dry_run, mode=self.gen_header()) 21 File "/software/setuptools-25.1.6/setuptools/command/bdist_egg.py", line 465, in make_zipfile 22 z = zipfile.ZipFile(zip_filename, mode, compression=compression) 23 File "/usr/local/lib/python2.7/zipfile.py", line 736, in __init__ 24 "Compression requires the (missing) zlib module" 25 RuntimeError: Compression requires the (missing) zlib module
解决方法:yum install zlib zlib-devel -y ,重新安装Python,进入Python安装包,执行 make, make install.
1 [[email protected] pip-8.1.2]# which pip 2 /usr/local/bin/pip 3 [[email protected] pip-8.1.2]# 4 [[email protected] pip-8.1.2]# 5 [[email protected] pip-8.1.2]# pip -V 6 Traceback (most recent call last): 7 File "/usr/local/bin/pip", line 9, in <module> 8 load_entry_point(‘pip==8.1.2‘, ‘console_scripts‘, ‘pip‘)() 9 File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 542, in load_entry_point 10 File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2570, in load_entry_point 11 File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2230, in load 12 File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2236, in resolve 13 File "/usr/local/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/__init__.py", line 16, in <module> 14 from pip.vcs import git, mercurial, subversion, bazaar # noqa 15 File "/usr/local/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/vcs/subversion.py", line 9, in <module> 16 from pip.index import Link 17 File "/usr/local/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/index.py", line 30, in <module> 18 from pip.wheel import Wheel, wheel_ext 19 File "/usr/local/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/wheel.py", line 39, in <module> 20 from pip._vendor.distlib.scripts import ScriptMaker 21 File "/usr/local/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/_vendor/distlib/scripts.py", line 14, in <module> 22 from .compat import sysconfig, detect_encoding, ZipFile 23 File "/usr/local/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/_vendor/distlib/compat.py", line 31, in <module> 24 from urllib2 import (Request, urlopen, URLError, HTTPError, 25 ImportError: cannot import name HTTPSHandler
解决方法:yum install openssl openssl-devel -y , 重新安装Python,然后再安装pip 即可
时间: 2024-10-08 16:58:52