centos6.5安装python3

Posted y_zilong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6.5安装python3相关的知识,希望对你有一定的参考价值。

现在好多人都不会用centos6.5安装python3,现在演示一下源码编译

[root@cent7_6 ~]$cat install_python3.sh 
#!/bin/bash
#
#********************************************************************
#Author:		    yzl
#QQ: 			    calm_yzl@163.com
#Date: 			    2021-10-22
#FileName:		    install_python3.sh
#URL: 			    yzil.cn
#Description:		The test script
#Copyright (C): 	2021 All rights reserved
#********************************************************************

cd /usr/local/src/
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar -xzvf Python-3.6.0.tgz
mkdir /usr/local/python3
cd Python-3.6.0
./configure --prefix=/usr/local/python3
make && make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
python3 -V

chmod 777 -R /usr/local/python3/

whereis python
rm -rf /usr/bin/python
ln -s /usr/local/python3/bin/python3 /usr/bin/python

[root@cent7_6 ~]$python
Python 3.6.0 (default, Oct 22 2021, 09:12:15) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

安装pip3和openpyxl 

wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py

python3 get-pip.py
 
pip3 -V
 
#如果出现
pip3 -V

-bash: pip3: command not found
 
使用find / -name pip
 
find / -name pip

/usr/local/python3/lib/python3.6/site-packages/pip
/usr/local/python3/bin/pip
/software/Python-3.6.2/Tools/msi/pip
/root/.cache/pip
 
#做pip的软链接
 
ln -s /usr/local/python3/bin/pip /usr/bin/pip3
 
pip3 -V
pip 18.0 from /usr/local/python3/lib/python3.6/site-packages/pip (python 3.6)
 
 
Centos 的python和pip的升级安装都已完成

pip3 install openpyxl

以上是关于centos6.5安装python3的主要内容,如果未能解决你的问题,请参考以下文章

centos6.5下安装python3安装python3虚拟环境创建venv

Centos6.5中实现python2与python3的并存

CentOS6.5源码安装python3.5.2

centos6.5安装python3

centos6.5安装python3.5 和 ipython

Centos6.5 编译安装python3.5版本,无法使用退格键方向键删除键等