从github repo安装pip - 如何在egg安装期间使用Cython构建C-extension

时间:2011-08-25 11:09:15

标签: python git pip cython egg

我可以使用以下命令

成功安装the DMSL package
git clone git://github.com/dasacc22/dmsl.git
cd dmsl
sudo python setup.py install

但是当我尝试使用pip

进行安装时
pip install -e git+git://github.com/dasacc22/dmsl.git#egg=dmsl

我收到错误

Obtaining dmsl from git+git://github.com/dasacc22/dmsl.git#egg=dmsl
  Updating /Users/andrei/.pythonbrew/venvs/Python-2.7.2/test/src/dmsl clone
  Running setup.py egg_info for package dmsl

    warning: no files found matching '*.html' under directory 'daml'
    warning: no files found matching '*.daml' under directory 'daml'
    warning: no files found matching '*.c' under directory 'daml'
Installing collected packages: dmsl
  Running setup.py develop for dmsl

    warning: no files found matching '*.html' under directory 'daml'
    warning: no files found matching '*.daml' under directory 'daml'
    warning: no files found matching '*.c' under directory 'daml'
    building 'dmsl.cdoc' extension
    gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/andrei/.pythonbrew/pythons/Python-2.7.2/include/python2.7 -c dmsl/cdoc.c -o build/temp.macosx-10.7-x86_64-2.7/dmsl/cdoc.o
    i686-apple-darwin11-llvm-gcc-4.2: dmsl/cdoc.c: No such file or directory
    i686-apple-darwin11-llvm-gcc-4.2: no input files
    error: command 'gcc' failed with exit status 1
    Complete output from command /Users/andrei/.pythonbrew/venvs/Python-2.7.2/test/bin/python -c "import setuptools; __file__='/Users/andrei/.pythonbrew/venvs/Python-2.7.2/test/src/dmsl/setup.py'; exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps:
    running develop

running egg_info

writing dmsl.egg-info/PKG-INFO
writing top-level names to dmsl.egg-info/top_level.txt
writing dependency_links to dmsl.egg-info/dependency_links.txt
writing dmsl.egg-info/PKG-INFO
writing top-level names to dmsl.egg-info/top_level.txt
writing dependency_links to dmsl.egg-info/dependency_links.txt

warning: manifest_maker: standard file '-c' not found

reading manifest file 'dmsl.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'

warning: no files found matching '*.html' under directory 'daml'
warning: no files found matching '*.daml' under directory 'daml'
warning: no files found matching '*.c' under directory 'daml'

writing manifest file 'dmsl.egg-info/SOURCES.txt'

running build_ext

building 'dmsl.cdoc' extension

gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/andrei/.pythonbrew/pythons/Python-2.7.2/include/python2.7 -c dmsl/cdoc.c -o build/temp.macosx-10.7-x86_64-2.7/dmsl/cdoc.o

i686-apple-darwin11-llvm-gcc-4.2: dmsl/cdoc.c: No such file or directory
i686-apple-darwin11-llvm-gcc-4.2: no input files

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /Users/andrei/.pythonbrew/venvs/Python-2.7.2/test/bin/python -c "import setuptools; __file__='/Users/andrei/.pythonbrew/venvs/Python-2.7.2/test/src/dmsl/setup.py'; exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps failed with error code 1
Storing complete log in /Users/andrei/.pip/pip.log

我该如何解决这个问题?


EDIT1:

我已经分配了回购并更正了MANIFEST.in所以在我的回购中它有

recursive-include dmsl *.html *.dmsl *.c

它找到* .html和* .dmsl,但问题是没有* .c文件,我需要用Cython创建。我已经安装了软件包,但作为一个python-newbie,我需要引导下一步。我该怎么做才能生成C文件?我是否需要向MANIFEST.insetup.py添加其他内容?


EDIT2:

我在freenode#python上得到了一些帮助。伙计们建议用python setup.py build_ext生成C文件并将它们添加到repo中。避免这种情况会很好。有没有办法用pip install自动运行build_ext命令?


仅供参考:有关此类问题,请访问freenode #pip。在那里你可能有幸找到jezdez;)

1 个答案:

答案 0 :(得分:3)

安装Pyrex后,安装对我有用。您可能希望将Cython和Pyrex添加到setup()调用的installed_requires参数中。