How to install Python3 on CentOS 7

~~How to install Python3 on CentOS 7

  1. Before installation

You need to install the dependent packages in order to let your python3 work perfectly after the installation.

Enter those code in the terminal

yum install -y zlib-devel bzip2-devel ncurses-devel gcc openssl-devel sqlite-devel tk-devel gdbm expat-devel gcc-C++ readline-devel
  1. Install Python

Step1 : download packages

Choose or build a folder you would like to download the installation packages of python using ‘cd’ & ‘mkdir’ command

cd ~ # make sure you are in the home directory
mkdir Packages/
cd Packages/
wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz # This command will download the installation packege to the folder you built

ps. try not to use python - 3.7.0, there’s some problem with it.
Step2 : install
When the downloading process is complete, you need to decompress the package and begin to install Python3

tar -zvxf Python-3.6.6.tgz
cd Python-3.6.6.
./configure --prefix=/usr/local/python/python3
make
make install

Step3: build soft connection
This is like build a short cut. You can call python without referring to its installed folder.

ln -s /usr/local/python/python3/bin/python3 /usr/bin/python3 # the latter path should be '/usr/local/python3' in case it may conflict with the built-in python of CentOS (version 2.7.5)

Step4: Use your Python!
enter ‘python3’ in the terminal
![使用python](https://img-blog.csdn.ne~~ t/20181017044649386?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl8zODY4NjczNw==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值