centos7.5 安装 thefuck -- 小米实战
安装前置依赖
yum -y groupinstall "Development tools" yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
确保原系统命令可以用
vi /usr/bin/yum 把#! /usr/bin/python修改为#! /usr/bin/python2 同理 vi /usr/libexec/urlgrabber-ext-down 文件里面的#! /usr/bin/python 也要修改为#! /usr/bin/python2
下载和安装
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz //下载地址可以在官网找到 tar -xvf Python-3.6.2.tar.xz //解压 ./configure prefix=/usr/local/python3 // 配置安装路径 make && make install // 编译和安装
建立软链方便使用
ln -s /usr/local/python3/bin/thefuck /usr/bin/thefuck ln -s /usr/local/python3/bin/fuck /usr/bin/fuck ln -s /usr/local/python3/bin/pip pip3 ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3.7 ln -s /usr/bin/python3.6 /usr/bin/python3
添加到系统的软件版本控制器
update-alternatives --install /usr/bin/pip pip /usr/bin/pip2 1 //添加PIP2 update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 2 //添加PIP3 update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 //添加python2 update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2 //添加python3 update-alternatives --list //查看清单 update-alternatives --config python //手动配置python pip同理 update-alternatives --auto python //自动配置python pip同理