企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
安装 ~~~ 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 if [ ! -f Python-3.6.5.tar.xz ]; then wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz fi rm -rf Python-3.6.5 tar xvJf Python-3.6.5.tar.xz mkdir /usr/local/python3 cd Python-3.6.5 ./configure --prefix=/usr/local/python3 make make install > python_install.log sed -i '1s/python/python2.7/' /usr/bin/yum sed -i '1s/python/python2.7/' /usr/libexec/urlgrabber-ext-down sed -i '1s/python/python2.7/' /usr/bin/yum-config-manager mv /usr/bin/python /usr/bin/python_bak ln -s /usr/local/python3/bin/python3 /usr/bin/python3 ln -s /usr/local/python3/bin/python3 /usr/bin/python ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip pip install gitpython pip list ~~~ 卸载 ~~~ rm -rf /usr/bin/python rm -rf /usr/bin/python3 rm -rf /usr/bin/pip rm -rf /usr/bin/pip3 mv /usr/bin/python_bak /usr/bin/python rm -rf /usr/local/python3 sed -i '1s/python2.7/python/' /usr/bin/yum sed -i '1s/python2.7/python/' /usr/libexec/urlgrabber-ext-down sed -i '1s/python2.7/python/' /usr/bin/yum-config-manager ~~~ 验证 ~~~ python -V ~~~ 检测yum ~~~ head -n 1 /usr/bin/yum head -n 1 /usr/libexec/urlgrabber-ext-down head -n 1 /usr/bin/yum-config-manager ~~~ 3.修改yum配置文件 因为yum使用python2,因此替换为python3后可能无法正常工作,继续使用这个python2.7.5 因此修改yum配置文件(vi /usr/bin/yum)。 把文件头部的#!/usr/bin/python改成#!/usr/bin/python2.7保存退出即可。 因为yum使用python2,因此替换为python3后可能无法正常工作,继续使用这个python2.7.5因此修改yum配置文件(vi /usr/bin/yum)。把文件头部的#!/usr/bin/python改成#!/usr/bin/python2.7保存退出即可 1. vim /usr/libexec/urlgrabber-ext-down 将/usr/bin/python改为/usr/bin/python2.7。 2. vim /usr/bin/yum-config-manager 解决办法同上: #!/usr/bin/python换成 #!/usr/bin/python2.7