1234567
# 非root 用户可以直接用以下命令安装wget https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tar.xztar -Jxvf Python-3.10.2.tar.xzcd Python-3.10.2./configure --prefix=/home/yourname/pythonmake make install
按照上面的方法安装之后可能有个问题是,用pip安装模块的时候,不能使用ssl,这可能和你没有openssl有关,所以需要在安装python的时候,添加openssl的依赖关系.
1
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
12345678
./configure --prefix=/home/yourname/python --with-openssl=/home/yourname/openssl_envmake make install# 添加环境变量export LIBRARY_PATH="/home/yourname/openssl_env/lib:$LIBRARY_PATH"export LD_LIBRARY_PATH="/home/yourname/openssl_env/lib:$LD_LIBRARY_PATH"