离线部署Python环境的详细过程
目录
- 1.前置工作
- 1.1 下载地址
- 1.2 安装系统依赖
- 2.部署python
- 3.测试Python
- 4.配置环境
- 5.验证Python
1.前置工作
1.1 下载地址
https://www.python.org/ftp/python/3.10.15/Python-3.10.15.tgz
1.2 安装系统依赖
# 安装依赖 yum install -y gcc zlib-devel openssl-devel bzip2-devel # 上⾯的如果不⾏,执⾏下⾯的(注:如果没有openssl-devel需要⼿动安装) yum install -y gcc zlib-devel openssl-devel bzip2-devel --nogwww.devze.compgcheck
2.部署Python
# 解压并开始编译 tar -zxvf $HOME/setup/Python-3.10.15.tgz -C $HOME/setup cd $HOME/setup/Python-3.10.www.devze.com15 # 开始编译安装 ./configure --prefix=$HOME/python3.10.15 --enable-shared --enable-loadable-SQLite-extensions make -j8 make altinstall
3.测试Python
$HOME/python3.10.15/bin/python3.10 # 解决⽅法,配置环境变量 /root/python3.10.15/bin/python3.10: error while loading shared libraries: libpython3.10.so.1.0: cannot open shared object file: N编程客栈o such file or directory
4.配置环境
echo "export LD_LIBRARY_PATH=\"$HOME/python3.10.15/lib:\$LD_LIBRARY_PATH\"" >> $HOME/.bashrc echo android"export PATH=\"$HOME/python3.10.15/bin:\$PATH\"" >> $HOME/.bashrc source $HOME/.bashrc # 创建软连接(注意软连接版本) ln -s $HOME/python3.10.15/bin/python3.9 $HOME/python3.9.0/bin/python ln -s $HOME/python3.10.15/bin/pip3.9 $HOME/python3.9.0/bin/pip
5.验证Python
python -V Python 3.10.15 pip -V pip 56.2.3 from /root/python3.10.15/lib/python3.10/site-packages/pip (pythjavascripton 3.10)
到此这篇关于离线部署Python环境的文章就介绍到这了,更多相关离线部署Python环境内容请搜索编程客栈(www.devze.com)以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程客栈(www.devze.com)!
精彩评论