tbenthompson / cppimport

Import C++ files directly from Python!
MIT License
1.18k stars 67 forks source link

Can not execute the test.py in tests file #50

Closed jmo2014 closed 4 years ago

jmo2014 commented 4 years ago

Does anyone has the same issue when executing the test.py in tests file?

The console gives me feedback like this:

Traceback (most recent call last): File "/Users/jiaqimo/Downloads/cppimport-stable/cmake_example copy/tests/test.py", line 1, in import cmake_example as m ModuleNotFoundError: No module named 'cmake_example'

tbenthompson commented 4 years ago

Happy to help, but I don't think I have enough information here. What is this cmake_example? And test.py is not a file in this repo.

jmo2014 commented 4 years ago

test.py is just a file that I want to execute and see how it goes with cpp import:

import cppimport somecode = cppimport.imp("somecode") #This will pause for a moment to compile the module somecode.square(9)

please use the following link. I make a somecode.cpp file and test.py file under test repository.

cppimport-stable.zip

tbenthompson commented 4 years ago

It looks like you cloned the repo, but didn't install it. Can you move the test.py and somecode.cpp somewhere outside the cloned repo, install with pip install cppimport and then try again?

jmo2014 commented 4 years ago

I use the command to install, but still didn't work because it tells me that I already installed it, and nothing happened.

WX20201019-100009@2x