cmake_example icon indicating copy to clipboard operation
cmake_example copied to clipboard

python file can't import module after change pybind target name

Open argentea opened this issue 4 years ago • 0 comments

I move the test_basic.py to project root directory and change the import path. Then, I change the target name in CMakeLists.txt and module name in test_basic.py. Then, "mkdir build; cd build; cmake ...; make", and everything goes well. However, when i run the test_basic.py, I get "Traceback (most recent call last): File "test_basic.py", line 2, in import build.bind_example as m ImportError: dynamic module does not define module export function (PyInit_bind_example) ".

Besides, when I change the target name back to cmake_example, the python file import module normally,

Attached files is the version which target name is changed. CMakeLists.txt

argentea avatar Sep 28 '21 05:09 argentea