1.下载软件并上传
下载地址(官网):https://www.python.org/downloads/
2.解压Python3安装文件
请在终端输入如下命令:
tar -zxvf Python-3.6.5.tgz -C /opt/module
3.安装编译Python3源文件所需的编译环境
yum install -y gcc
yum install -y zlib*
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel \
readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
4. 编译Python3
参考README.rst
Build Instructions
------------------
On Unix, Linux, BSD, macOS, and Cygwin::
./configure
make
make test
sudo make install
This will install Python as ``python3``.
Note that this
installs the Python executable in a place that is not normally on your PATH,
you may want to set up a symlink in ``/usr/local/bin``.
执行:
./configure
make
sudo make install
可能遇到的问题:
CentOs7安装Python3.7报错
ModuleNotFoundError: No module named '_ctypes'
执行:
yum install libffi-devel
./configure --enable-optimizations
make altinstall
安装ipython
pip3.7 install ipython
注:pip3.7可以到/usr/local/bin中查看是否存在此命令,3.7为版本号