简体   繁体   English

为什么我的setup.py脚本会出现此错误?

[英]Why does my setup.py script give this error?

So I have a C++ class that I made python wrappers for, and I made a setup.py file to compile it in order to use it in python. 因此,我有一个C ++类,我为此制作了python包装器,并制作了setup.py文件进行编译,以便在python中使用它。 When I try to run python setup.py install I get the following error: 当我尝试运行python setup.py install时,出现以下错误:

lipo: can't create output file: build/temp.macosx-10.5-fat3-2.7/../tools/transport-stream/TransportStreamPacket_py.o (No such file or directory)
error: command 'gcc-4.0' failed with exit status 1

I don't think the problem is with the file being compiled, I think I must be setting up the setup.py wrong. 我认为问题不在于正在编译的文件,我认为我必须将setup.py设置错误。 Here is what my setup.py file looks like: 这是我的setup.py文件的样子:

from distutils.core import setup, Extension

module1 = Extension('CL_TransportStreamPacket_py',
                sources = ['../tools/transport-stream/TransportStreamPacket_py.cpp'],

                include_dirs = ['.',
                    '../common',
                    '../tools/transport-stream'],

                library_dirs = ['common',
                    '../tools/transport-stream'],

                libraries = ['Common',
                    'TransportStream']

            )

setup (name = 'CL_TransportStreamPacket_py',
     version = '1.0',
     description = 'This is the transport stream packet parser',
     ext_modules = [module1])

Your problem is the leading '..' in the source definitions. 您的问题是源代码定义中的前导'..' Distutils uses the names of the source files to generate names of temporary and output files, but doesn't normalize them. Distutils使用源文件的名称来生成临时文件和输出文件的名称,但不会对其进行规范化。 Reorganize your source tree (or move the setup.py file) so you don't need to reference '../tools/...' 重新组织源代码树(或移动setup.py文件),因此您无需引用'../tools/...'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM