redhat 搭建本地yum仓库并安装python3

1.挂载光盘

[root@localhost yum.repos.d]# mount /dev/sr0 /mnt
mount: /dev/sr0 is write-protected, mounting read-only

2.配置本地源文件

[root@localhost ~]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# vim base.repo



[base]                  #源标识
name=base               #源名称
baseurl=file:///mnt     #路径
enable=1                #启用
gpgcheck=0              #不校验

3.安装与卸载软件

yum install 包名 -y   安装
yum remove 包名 -y    卸载

4.安装python3所需的依赖环境

yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc gcc-c++ zlib*

5.下载所需的python包

[root@localhost ~]# wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz

6.解压并安装

[root@localhost ~]# tar -xvf Python-3.6.0.tgz 

[root@localhost ~]# mkdir /usr/local/python3

[root@localhost ~]# cd Python-3.6.0/

[root@localhost Python-3.6.0]# ./configure --prefix=/usr/local/python3

[root@localhost Python-3.6.0]# make

[root@localhost Python-3.6.0]# make install

[root@localhost ~]# ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3

[root@localhost bin]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3


7.查看

[root@localhost bin]# python3
Python 3.6.0 (default, Aug 15 2018, 02:31:32) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> 
>>> 
>>> 

猜你喜欢

转载自blog.csdn.net/weixin_38280090/article/details/81707017