我举个例子:
$ curl -LO http://nuitka.net/releases/Nuitka-0.5.18.1.tar.gz
$ tar xf Nuitka-0.5.18.1.tar.gz
$ echo 'print "Hello, Nuitka!"' > Hello.py
$ ./Nuitka-0.5.18.1/bin/nuitka Hello.py
$ chmod +x hello.exe
$ ./Hello.exe
Hello, Nuitka!
我举个例子:
$ curl -LO http://nuitka.net/releases/Nuitka-0.5.18.1.tar.gz
$ tar xf Nuitka-0.5.18.1.tar.gz
$ echo 'print "Hello, Nuitka!"' > Hello.py
$ ./Nuitka-0.5.18.1/bin/nuitka Hello.py
$ chmod +x hello.exe
$ ./Hello.exe
Hello, Nuitka!
|
KilerdJan 29, 2016
1
跟 py2exe 有什么区别?
|
|
2
It translates the Python into a C level program that then uses "libpython" to execute in the same way as CPython does.
|
|
4
$ du -h ./Hello.exe
92K |
|
6
|
|
icedxJan 29, 2016
7
|
|
nightv2Jan 30, 2016 via Android
8
pyinstall 打包为一个文件不是更好一些么
|
|
KarblueJan 30, 2016 via Android
9
libpython 加上其他打包的 python 运行库。体积还不如 py2exe
|
|
bear330Jan 31, 2016
10
它的重點應該不是打包吧, 而是它會把你的 python code 轉成直接用 python 的 c API 形式的 c++程式碼, 然後給 c++編譯器去編譯, 好處是可以在幾乎 100%的相容性上得到 static compiler 的優化能力, 例如你的 python 函數寫:
def f(i): return i + 1 + 20 f(100) 在轉成對應的 c++ code 編譯後, 就可以直接把 1 + 20 換成 21, 甚至把 f(100)這行整個直接 inline 了, 進而優化整個程式的效能, 卻保持程式相容性 (不像 pypy 要舍棄一些相容性, 如果用到 c extension 的話) |