问题
in python,can i load a module from remote server to local? what i do this is want to protect my source code. what should i do ,thanks
回答1:
it can be done via python import hooks. see knockout for an implementation that you can either use directly or as a starting point to add further code-protection logic
回答2:
A bit off topic but if source protection is what you need C-compile your python source with cython and distribute .pyd files.
You'll have to:
- adapt your source to be cython compilant (not all code can be converted)
- precompile .pyd files for platforms you want to support (Windows, Ubuntu, Fedora etc...)
回答3:
Yes, you can import your code in creative ways.
No, it will not protect the code from being seen. Rethink your strategy, not tactics.
来源:https://stackoverflow.com/questions/5470161/python-can-load-modules-from-remote-server