Centos8离线安装Python-3.6.15

在路上 2022-03-31 阅读:1980 评论:0
一、python环境准备1.安装依赖[root@localhost Python-3.6.15]# yum install gcc2.官网下载安装包wget https://www.pyth...

一、python环境准备

1.安装依赖

[root@localhost Python-3.6.15]# yum install gcc

2.官网下载安装包

wget https://www.python.org/ftp/python/3.6.15/Python-3.6.15.tgz

3.解压缩安装包

tar -zxf Python-3.6.15.tgz

4.编译安装

cd Python-3.6.15
[root@localhost Python-3.6.15]# ./configure --prefix=/usr/local/python3
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.6... no
checking for python3... no
checking for python... no
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... linux
checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for a sed that does not truncate output... /usr/bin/sed
checking for --with-cxx-main=<compiler>... no
checking for g++... no



If you want a release build with all stable optimizations active (PGO, etc),
please run ./configure --enable-optimizations


[root@localhost Python-3.6.15]#


5完成后执行make

[root@localhost Python-3.6.15]# make

[root@localhost Python-3.6.15]# make install

6.创建新版本的链接

[root@localhost Python-3.6.15]# ln -s /usr/local/python3/bin/python3 /usr/bin/python

7.验证版本

[root@localhost ~]# python -V
Python 3.6.15

软连接创建成功

8,需进一步配置pip3

[root@localhost ~]# vim /etc/profile

末尾加入

PATH=$PATH:$HOME/bin:
PATH=$PATH:$HOME/bin:/usr/local/python3/bin

完成后,这时pip3就可以使用了。


版权声明

本文仅代表作者观点,不代表百度立场。
本文系作者授权百度百家发表,未经许可,不得转载。

分享:

扫一扫在手机阅读、分享本文

热门文章
  • 告诉老默,我想换系统了

    告诉老默,我想换系统了
       在电视剧狂飙中,高启强动手时,总会说一句,告诉老默,我想吃鱼了,现在言归正传,改变一下Windows和Linux的使用方式,也可以动手了。      在实际工作中,如果经常用Windows和Linux打交道,可能需要安装虚拟机来解决互相测试访问的问题,这样还面临D版的风险,那么问题来了,能不能不用虚拟机,用Linux的方式使用Windows,老实说这个需求在过去,比买等离子电视还难,但是最近几年,Windows已经做的相当不错了  下面来说说,Windows10,Win...
  • Windows系统鼠标右键菜单添加打开cmd终端

    Windows系统鼠标右键菜单添加打开cmd终端
      当要在某个文件夹下打开cmd终端时,如果没有右键菜单快捷方式,就得打开cmd后,使用cd方式进入 当前目录,很麻烦。 以下的脚本,可以帮你解决这个问题。第一步:新建一个txt文件,名字叫什么无所谓的 第二步:复制以下代码到刚才的txt文件中Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHere] @="在此处打开命令窗口" "Icon"="cmd.ex...