PyPy和PyInstaller

Dim*_*nek 19 python pypy pyinstaller

是否可以构建一个单二进制或单目录包PyInstaller,pypy用作解释器?

有什么特别的伎俩吗?

一些替代PyInstaller

如果没有,基本技术原因是什么?

注意为什么/如何pyinstaller没有开箱即用的pypy:

  • distutils.sysconfig.get_config_h_filename缺失,已在pytinstaller trunk中修复
  • (distutils.|)sysconfig.(_ |)缺少get_makefile_filename,实际上是可选的
  • 尝试链接libpython2.7.so.1,pypy在单个可执行文件中,而不是共享对象

iCh*_*hux 7

我已经尝试过了,但很多时候它都失败了,因为PyPy只能使用CPython使用的几个子集.PyInstaller是一个完整的CPython应用程序,因此无法进行通信.

PyInstaller的机制对CPython的工作方式很敏感,因此PyPy可以引入一些问题.这是在PyPy虚拟环境中尝试运行PyInstaller时会得到的:

OSError: Python library not found: Python, .Python, libpython3.5.dylib,
libpython3.5m.dylib

This would mean your Python installation doesn't come with proper library files.

This usually happens by missing development package, or unsuitable build
parameters of Python installation.

* On Debian/Ubuntu, you would need to install Python development packages
  * apt-get install python3-dev
  * apt-get install python-dev
* If you're building Python by yourself, please rebuild your Python with
  `--enable-shared` (or, `--enable-framework` on Darwin)
Run Code Online (Sandbox Code Playgroud)

如果你需要提高速度并将代码隐藏起来,你可以试试Cython.我经常使用Cython和PyInstaller,我喜欢他们的跨平台性质.

当您使用两者时,您可以使用PyInstaller和CPython打包您的应用程序.