将你的Python代码部署到云服务器上

1.准备

在:https://www.python.org/downloads/

选择好想要安装的python版本,点击Download

往下翻,右键Gzipped source tarball点击复制链接地址

 2.下载压缩包

1.SSH连接服务器,输入wget+刚才复制的链接 

wget -O pythonzip.tgz 刚才复制的链接

 2.安装依赖包:

yum install -y gcc patch libffi-devel python-devel  zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

3.解压压缩包:

tar -zxvf pythonzip.tgz

 4.创建安装目录:

mkdir -p  /usr/local/python

5.移动解压的Python包:

ls
mv  ./Python-3.10.8  /usr/local/python

6.进入目录:

cd /usr/local/python/Python-3.10.8

7.安装Python(这一步比较长):

./configure

8.编译执行(这一步比较长):

make
make install

3.完成

运行代码方法:

./python3.10 你的python脚本
阅读剩余
THE END