• 周日. 7月 3rd, 2022

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

ubuntu 16 源码安装python

admin

11月 28, 2021

1. 查看当前系统是否安装

python3 -V

2. 完全卸载

sudo apt-get –purge remove python

4. 安装依赖文件

[email protected]:/home/controller/Downloads/python# sudo apt-get install -y gcc make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev

5. 下载源码

https://www.python.org/downloads/source/

sudo curl -O https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz

6. 解压

tar Jxvf Python-3.7.1.tar.xz

[email protected]:/usr/local/src/python# make && make install
7. 配置环境

[email protected]:/usr/local/src/python3/bin# ./python3 -V
Python 3.9.6
[email protected]:/usr/local/src/python3/bin# ./pip3 -V
pip 21.1.3 from /usr/local/src/python3/lib/python3.9/site-packages/pip (python 3.9)
[email protected]:/usr/local/src/python3/bin#

[email protected]:/usr/local/src/python3# nano /etc/profile

export PYTHON=/usr/local/src/python3
export JAVA_HOME=/usr/local/src/java
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${PYTHON}/bin:${JAVA_HOME}/bin:$PATH

配置之后 source一下

source  /etc/profile

8. 测试

[email protected]:~# python3 -V
Python 3.9.6
[email protected]:~# pip3 -V

发表评论

您的电子邮箱地址不会被公开。