Search code examples
pythoncdistutilssetup.py

python setup.py: how to set the path for the generated .so


I have this setup.py:

from distutils.core import setup, Extension
from setuptools import setup, Extension
import numpy as np

module1 = Extension('filename',
                    sources = ['utilities/filename.c'])

setup (name = 'library',
       version = '1.0',
       description = 'library',
       include_dirs = [np.get_include()],
       ext_modules = [module1])

I want to create the filename.so into the folder utilities. I tried with

python setup.py build -f --build-temp=. -e utilities/

but this put only the filename.o file into utilities/ and the .so into build/lib...

Any idea? Is it possible or not?


Solution

  • If you want extensions modules to be build in the same directory you could use this:

    python setup.py build_ext --inplace
    

    Or you can add this parameter to specify a build folder

    --build-lib=folderx