linux安装python脚本_Linux安装python

1、下载python3版本

$ cd opt/

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

2、创建python安装路径

$ mkdir -p /software/python3

3、解压python

$ cd /opt

$ tar -zxvf Python-3.7.1.tgz

4、python3.7版本之后需要一个新的包libffi-devel

$ yum install libffi-devel -y

5、进入python文件夹,生成编译脚本(指定安装目录)

$ cd /opt/Python-3.7.1

$ ./configure --prefix=/software/python3

6、编译

$ make

7、编译成功后,编译安装

$ make install

8、检查python3.7的编译器:/software/python3/bin/python3.7

$ /software/python3/bin/python3

9、建立Python3的软链接和pip3的软链接

$ ln -s /software/python3/bin/python3 /usr/bin/python3

$ ln -s /software/python3/bin/pip3 /usr/bin/pip3

10、将/usr/local/python3/bin加入PATH

$ vim ~/.bash_profile

# User specific environment and startup programs

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

export PATH

11、

7.检查Python3及pip3是否正常可用

$ python3 -V

$ pip3 -V

你可能感兴趣的:(linux安装python脚本)