我考,原来python也能编译成二进制,即脱离python环境运行,我还以为这只是c,c++,golang这些语言才能做的。好吧,我承认,我今天才知道。。。。

 

pyinstaller 安装

1.     安装pip

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

python3 get-pip.py

2.     安装pyinstaller

pip install pyinstaller

3.     安装python-dev

     4.  安装binutils

apt-get install binutils

 

 编译命令

编译命令: pyinstaller -F venom_checkout.py

Pyinstaller编译说明文档:https://pyinstaller.readthedocs.io/en/stable/usage.html

 

 注意(坑):

 

https://github.com/pyinstaller/pyinstaller/wiki/FAQ

pyinstaller 把python编译成二进制

 

Pyinstallglibc不向前兼容,也就是如果用新操作系统编译的版本,放到旧系统上运行会报错,我这就碰到了” /tmp/_MEI2M4CYn/libreadline.so.6: no version information available (required by /bin/sh)”的错误。因为我用了ubuntu16编译的二进制,放到了suse12上运行,结果遇到了上面的问题。

 

解决办法:

1.       按照上文说的使用老版本编,可通过ldd –version查看glibc版本

2.       使用staticX

3.       赶紧用golang来编写吧

相关文章:

  • 2021-11-22
  • 2022-12-23
  • 2021-10-19
  • 2021-05-29
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-05
  • 2021-07-09
相关资源
相似解决方案