基础服务安装步骤

python编译安装 openssl升级为1.1.1 https://docs.python.org/zh-cn/3/using/configure.html Python 3.10 及以上必须使用 OpenSSL ≥ 1.1.1,低于此版本会导致 ssl 模块不可用、pip 无法使用 HTTPS 等问题。 wget https://www.openssl.org/source/openssl-1.1.1.tar.gz cd /home/work/software/openssl-1.1.1 # (no-shared 指定生成的openssl库为静态库,即生成libcrypto.a和libssl.a;(默认生成动态库)) ./config no-shared --prefix=/home/work/environment/openssl_1.1.1 make -j$(nproc) make install 编译Python-3.10.14 wget https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tar.xz tar -xf Python-3.10.14.tar.xz cd /home/work/software/Python-3.10.14 # 编译并安装 ./configure --enable-optimizations --with-lto --with-openssl=/home/work/environment/openssl_1.1.1 --prefix=/home/work/environment/python310 make -j$(nproc) make install # 配置全局环境变量 sudo tee -a /etc/profile <<EOF export PYTHON3_HOME=/home/work/environment/python310 export PATH=$PATH:$PYTHON3_HOME/bin EOF sudo source /etc/profile pip源配置 # pip源配置 vim /etc/pip.conf [global] timeout = 60 index = http://pip.baidu.com/root/baidu/ index-url = http://pip.baidu.com/root/baidu/+simple/ trusted-host = pip.baidu.com [list] format = columns 创建虚拟环境 ...

March 23, 2026 · 2 min · Arles Zhang