PythonCode环境

  • Linux更换pip源
python2.7
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python3.6
wget https://bootstrap.pypa.io/pip/3.6/get-pip.py

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
mkdir ~/.pip
cat << EOF >> ~/.pip/pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
break-system-packages = true
EOF
  • Centos安装python3.8
yum install zlib zlib-devel bzip2-devel ncurses-devel sqlite-devel readline-devel libffi libffi-devel openssl-devel tk-devel gcc gcc-c++ make -y
wget https://www.python.org/ftp/python/3.8.19/Python-3.8.19.tgz --no-check-certificate
tar xvf Python-3.8.19.tgz
cd Python-3.8.19
./configure --enable-shared
make&&make install
find /usr/local -name libpython*.1.0 -exec cp {} /usr/lib/ \; -exec cp {} /usr/lib64/ \;
  • pyinstaller编译exe
yum install libffi-devel -y
pip3 install --upgrade pip setuptools wheel
pip3 install pyinstaller
  • gcc升级
yum install centos-release-scl /y
yum install devtoolset-8-gcc devtoolset-8-gcc-c++ /y
echo "source /opt/rh/devtoolset-8/enable" >>~/.bashrc
pyinstaller -F -i favicon.ico demo.py
  • nuitka编译exe
yum install ccache patchelf python3-devel /y
pip3 install zstandard -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install orderedset -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install nuitka -i https://pypi.tuna.tsinghua.edu.cn/simple

nuitka --standalone --onefile --remove-output --mingw64 demo.py