我正在尝试从python,flask和boto3 app创建二进制文件。我无法运行pip install cx_Freeze
命令。我收到以下错误:
似乎没有获取正确的系统库。此外,任何人都可以建议任何工具将python应用程序打包成二进制文件吗?
Failed building wheel for cx-Freeze
Running setup.py clean for cx-Freeze
Failed to build cx-Freeze
Installing collected packages: cx-Freeze
Running setup.py install for cx-Freeze ... error
Complete output from command /home/shaswat.g/.virtualenvs/flask_app/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yLvkz9/cx-Freeze/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-kKRaSM-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/shaswat.g/.virtualenvs/flask_app/include/site/python2.7/cx-Freeze:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/dist.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/main.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/common.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/__init__.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/macdist.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/finder.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/setupwriter.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/windist.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/hooks.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/freezer.py -> build/lib.linux-x86_64-2.7/cx_Freeze
creating build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/SharedLibSource.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/__startup__.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/SharedLib.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/ConsoleSetLibPath.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/Console.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/relimport
copying cx_Freeze/samples/relimport/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/relimport
copying cx_Freeze/samples/relimport/relimport.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/relimport
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
copying cx_Freeze/samples/service/Config.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
copying cx_Freeze/samples/service/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
copying cx_Freeze/samples/service/ServiceHandler.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/openpyxl
copying cx_Freeze/samples/openpyxl/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/openpyxl
copying cx_Freeze/samples/openpyxl/test_openpyxl.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/openpyxl
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/simple
copying cx_Freeze/samples/simple/hello.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/simple
copying cx_Freeze/samples/simple/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/simple
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/matplotlib
copying cx_Freeze/samples/matplotlib/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/matplotlib
copying cx_Freeze/samples/matplotlib/matplotlib_eg.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/ matplotlib
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/PyQt4
copying cx_Freeze/samples/PyQt4/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/PyQt4
copying cx_Freeze/samples/PyQt4/PyQt4app.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/PyQt4
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
copying cx_Freeze/samples/advanced/advanced_1.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
copying cx_Freeze/samples/advanced/advanced_2.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
copying cx_Freeze/samples/advanced/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/asmodule
copying cx_Freeze/samples/asmodule/asmodule.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/asmodule
copying cx_Freeze/samples/asmodule/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/asmodule
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/zope
copying cx_Freeze/samples/zope/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/zope
copying cx_Freeze/samples/zope/qotd.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/zope
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/Tkinter
copying cx_Freeze/samples/Tkinter/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/Tkinter
copying cx_Freeze/samples/Tkinter/SimpleTkApp.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/Tkinter
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/wx
copying cx_Freeze/samples/wx/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/wx
copying cx_Freeze/samples/wx/wxapp.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/wx
running build_ext
building 'cx_Freeze.util' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/source
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/util.c -o build/temp.linux-x86_64-2.7/source/util.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/ python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/source/util.o -o build/ lib.linux-x86_64-2.7/cx_Freeze/util.so
creating build/temp.linux-x86_64-2.7/source/bases
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/bases/ Console.c -o build/temp.linux-x86_64-2.7/source/bases/Console.o
creating build/lib.linux-x86_64-2.7/cx_Freeze/bases
x86_64-linux-gnu-gcc -pthread build/temp.linux-x86_64-2.7/source/bases/Console.o -L/usr/lib/python2.7/ config-x86_64-linux-gnu -lpython2.7 -o build/lib.linux-x86_64-2.7/cx_Freeze/bases/Console -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -lpthread -ldl -lutil -lm -L/usr/lib -lz -s
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/shaswat.g/.virtualenvs/flask_app/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yLvkz9/cx-Freeze/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-kKRaSM-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/shaswat.g/.virtualenvs/flask_app/include/site/python2.7/cx-Freeze" failed with error code 1 in /tmp/pip-build-yLvkz9/cx-Freeze/
答案 0 :(得分:5)
只做
sudo apt install zlib1g-dev
我试图安装cx-freeze
将一些python代码转换为exe,但问题是/usr/bin/ld: cannot find -lz
就像你一样。正在提取的文件已压缩(cx_Freeze-5.1.1.tar.gz
),因此您需要zlib
。当然对python3使用pip3
。
答案 1 :(得分:2)