Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/353.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在mac上将Python3编译成可执行的二进制文件_Python_Macos_Python 3.x_Gcc_Cython - Fatal编程技术网

在mac上将Python3编译成可执行的二进制文件

在mac上将Python3编译成可执行的二进制文件,python,macos,python-3.x,gcc,cython,Python,Macos,Python 3.x,Gcc,Cython,我打算在MacOSX上将Python3命令行程序编译成二进制可执行文件 我的python3安装是用自制软件完成的,但是当我尝试运行 gcc-Os-I/usr/local/ceral/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/Headers-o at_analyzer at_analyzer.c-lpython3.5m-lpthread-lm-lutil-ldl-v 我得到以下错误: Apple LLVM version 8

我打算在MacOSX上将Python3命令行程序编译成二进制可执行文件

我的python3安装是用自制软件完成的,但是当我尝试运行

gcc-Os-I/usr/local/ceral/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/Headers-o at_analyzer at_analyzer.c-lpython3.5m-lpthread-lm-lutil-ldl-v

我得到以下错误:

Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name at_analyzer.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 274.1 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I /usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/Headers -Os -fdebug-compilation-dir /Users/alex/Source/AT_analyzer -ferror-limit 19 -fmessage-length 150 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /var/folders/8l/3c5cnrvj1hg_qbr73dz1pnq40000gn/T/at_analyzer-e9d098.o -x c at_analyzer.c
clang -cc1 version 8.0.0 (clang-800.0.42.1) default target x86_64-apple-darwin16.1.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/Headers
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks (framework directory)
End of search list.
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.12.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -o at_analyzer /var/folders/8l/3c5cnrvj1hg_qbr73dz1pnq40000gn/T/at_analyzer-e9d098.o -lpython3.5m -lpthread -lm -lutil -ldl -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib/darwin/libclang_rt.osx.a
ld: library not found for -lpython3.5m
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Apple LLVM 8.0.0版(clang-800.0.42.1)
目标:x86_64-apple-darwin16.1.0
线程模型:posix
InstalledDir:/Applications/Xcode.app/Contents/Developer/Toolchains/xcodefault.xctoolchain/usr/bin
“/Applications/Xcode.app/Contents/Developer/toolschains/xcodefault.xctoolschain/usr/bin/clang”-cc1-triple x86_64-apple-macosx10.12.0-Wdeprecated objc isa用法-Werror=不推荐的objc isa用法-emit obj-禁用自由-禁用llvm验证器-丢弃值名称-在_analyzer.c处的主文件名-mrelocation model pic-pic level 2-mthread model posix-mdisable fp elim-masm verbose-munwind tables-target cpu penryn-target linker version274.1-v-dwarf-column-info-debugger tuning=lldb-resource dir/Applications/Xcode.app/Contents/Developer/Toolchains/Xcode default.xctoolchain/usr/bin//lib/clang/8.0.0-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk-I/usr/local/ceral/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/Headers-Os-fdebug编译dir/Users/alex/Source/AT_analyzer-ferror limit 19-fmessage length 150-stack protector 1-fblocks-fobjc runtime=macosx-10.12.0-fencode扩展块签名-fmax type align=16-fdiagnostics show选项-fcolor诊断-矢量化回路-矢量化slp-o/var/folders/8l/3c5cnrvj1hg_qbr73dz1pnq40000gn/T/at_analyzer-e9d098.o-x c at_analyzer.c
clang-cc1版本8.0.0(clang-800.0.42.1)默认目标x86_64-apple-darwin16.1.0
忽略不存在的目录“/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/local/include”
忽略不存在的目录“/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Library/Frameworks”
#包括“…”搜索从这里开始:
#包括搜索从这里开始:
/usr/local/ceral/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/Headers
/Applications/Xcode.app/Contents/Developer/toolschains/XcodeDefault.xctoolschain/usr/bin/./lib/clang/8.0.0/include
/Applications/Xcode.app/Contents/Developer/toolschains/xcodefault.xctoolschain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks(框架目录)
搜索列表结束。
“/Applications/Xcode.app/Contents/Developer/toolschains/xcodefault.xctoolschain/usr/bin/ld”-demangle-dynamic-arch x86_64-macosx_version_min 10.12.0-syslibroot/Applications/Xcode.app/Contents/Developer/Platforms/macosx.platform/Developer/SDKs/MacOSX10.12.sdk-o at_analyzer/var/folders/8l/3C5CNVJ1Hg_qbr73dz1pnq40000gn/T/at_analyzer-e9d098.o-lpython3.5m-lpthread-lm-lutil-ldl-lSystem/Applications/Xcode.app/Contents/Developer/toolschains/XcodeDefault.xctoolchain/usr/bin/./lib/clang/8.0.0/lib/darwin/libclang\u rt.osx.a
ld:找不到-lpython3.5m的库
叮当声:错误:链接器命令失败,退出代码为1(使用-v查看调用)

任何帮助都将不胜感激。

解决了这个问题。我需要用指向库的路径指定-L标志


gcc-Os-I/usr/local/ceral/python3/3.5.2_3/Frameworks/Python.Frameworks/Frameworks/Frameworks/Frameworks/python3/3.5/Headers-L/usr/local/ceral/python3/3.5.5/lib-o at_分析器at_分析器at_分析器c-lpython3.5m-lpthread-lm-lutil-ldl-v
解决了这个问题。我需要用指向库的路径指定-L标志

gcc-Os-I/usr/local/ceral/python3/3.5.2_3/Frameworks/Python.Frameworks/Frameworks/Frameworks/Frameworks/3.5/Headers-L/usr/local/ceral/python3/3.5.2_/lib-o at_analyzer at_.c-lpython3.5m-lpthread-lm-lutil-ldl-v