Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing a .pyd (created with SWIG) in Python 2.7.3 on Mac

I have created a .pyd file with SWIG under Windows named (_example.pyd).

I am able to send the file to my email and import it with another Windows machine using the same version of Python (Python 2.7.3) with this simple command:

.>>> import _example

.>>>

But when I send it to my email and tried to import the file with a Mac, I get:

"No module named _example"

Any ideas?

In both cases, I saved the file into the Python path.

like image 828
user1449530 Avatar asked Nov 16 '25 11:11

user1449530


1 Answers

This is because Python extensions (.pyd files) are essentially DLLs.
If you want to use your extension on a Mac, you will need to compile it for/on a Mac.

http://docs.python.org/faq/windows.html#is-a-pyd-file-the-same-as-a-dll

like image 76
aukaost Avatar answered Nov 18 '25 19:11

aukaost



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!