2014-01-08 51 views
4

我想在開發模式下安裝我的Python模塊。正如我在許多例子中看到python setup.py develop應該這樣做。但develop命令不爲我setup.py文件存在:爲什麼`setup.py develop`不起作用?

from distutils.core import setup 
from distutils.extension import Extension 
from Cython.Build import cythonize 
from Cython.Distutils import build_ext 

import os 

src = ["_NetworKit.pyx"] # list of source files 
modules = [Extension("_NetworKit", 
        src, 
        language = "c++", 
        extra_compile_args=["-fopenmp", "-std=c++11", "-O3", "-DNOGTEST"], 
        extra_link_args=["-fopenmp", "-std=c++11"], 
        libraries=["NetworKit-Core-O"], 
        library_dirs=["../"])] 

for e in modules: 
    e.cython_directives = {"embedsignature" : True} 

setup(name="_NetworKit", 
    cmdclass={"build_ext": build_ext}, 
    ext_modules=modules, 
    py_modules = ["NetworKit.py"]) 

(注意用Cython擴展模塊)。

我錯過了什麼?我需要修改setup.py嗎?

回答

10

develop命令是setuptools的一部分。安裝setuptools並用setup.py替換第一行:

from setuptools import setup