Here I found how to write setup.py
file for compiling my own C/C++ modules for python, but I can't specify more than one include directories from command line.
Please tell me the syntax how should I specify a list of directories from command line for setup.py
.
To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.
Setuptools is a collection of enhancements to the Python distutils that allow developers to more easily build and distribute Python packages, especially ones that have dependencies on other packages.
You may still find advice all over the place that involves invoking setup.py directly, but unfortunately this is no longer good advice because as of the last few years all direct invocations of setup.py are effectively deprecated in favor of invocations via purpose-built and/or standards-based CLI tools like pip, build ...
I found the solution it should look like this
python setup.py build_ext --inplace --library-dirs=lib_dir1;lib_dir2 --include-dirs=inc_dir1;inc_dir2
The help for setup.py
tells, you can specify multiple values delimited by ":"
Shortened output:
$ python setup.py build_ext --help
Common commands: (see '--help-commands' for more)
setup.py build will build the package underneath 'build/'
setup.py install will install the package
Options for 'build_ext' command:
--include-dirs (-I) list of directories to search for header files
(separated by ':')
alternative option inside setup.py
:
#! /bin/python
environ['CPPFLAGS'] = '-I/usr/local/opt/openssl/include -I/usr/include -I/usr/local/include'
environ['LDFLAGS'] = '-L/usr/local/opt/lib1/lib -L/usr/local/opt/lib2/lib'
alternative option from unix cli:
#! /bin/bash
export CPPFLAGS='-I/usr/local/opt/openssl/include -I/usr/include -I/usr/local/include'
export LDFLAGS='-L/usr/local/opt/lib1/lib -L/usr/local/opt/lib2/lib'
fyi, I used the environ
example to install pycurl
from my projects setup.py after searching for a long time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With