源码安装 Python 3.8

安装编译所需的依赖:首先安装一些编译 Python 所需的依赖包:

yum groupinstall "Development Tools"
yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel

下载 Python 3.8 源码

cd /usr/src
sudo wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz

解压源码包

sudo tar xzf Python-3.8.0.tgz
cd Python-3.8.0

编译和安装 Python 3.8

sudo ./configure --enable-optimizations
sudo make altinstall

验证安装

[root@host test]# python3.8 --version
Python 3.8.0

报错解决:

[root@host test]# python3 jiankongtest.py 
/usr/local/lib/python3.6/site-packages/paramiko/transport.py:32: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
  from cryptography.hazmat.backends import default_backend
 * Serving Flask app 'jiankongtest' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
/usr/local/lib/python3.6/site-packages/paramiko/transport.py:32: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
  from cryptography.hazmat.backends import default_backend
 * Debugger is active!
 * Debugger PIN: 441-708-060

安装 pip

yum install python38-pip

 手动安装:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.8 get-pip.py

 安装 Flask 和 Paramiko

python3.8 -m pip install flask paramiko

 运行 Flask 项目

python3.8 jiankongtest.py

 

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐