I am trying to compile, install and run a package that we'll call myPackage
. It contains a *.pyx
file that calls the function fftw_set_timelimit()
from library fftw
. Currently, when I run a script clientScript.py
that imports the package I obtain the following error message :
Traceback (most recent call last):
File "clientScript.py", line 5, in <module>
import myPackage.myModule
ImportError: /usr/local/lib/python2.7/dist-packages/myPackage/myModule.so: undefined symbol: fftw_set_timelimit
From what I understand (I am quite new to python and cython), the linking with the C library is not yet performed in my package. Indeed, my setup.py
file looks like this :
from setuptools import setup,find_packages
from Cython.Build import cythonize
import os
setup(
name = "myPackage",
version = "0.0.1",
url = "none",
author = "me",
author_email = "[email protected]",
packages=find_packages(),
ext_modules = cythonize("pyClo/pyClo.pyx"),
)
As you can see my setup.py
file uses setuptools
. I decided to do so since it is recommended by the Python Packaging User Guide. However, the instructions in the Cython documentation use distutils
instead. Linking libraries is done through a call to distutils.Extension('file',['file.pyx'],libraries='fftw')
. How do I achieve the same result using setuptools
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…