开发者

Make Python import .pyc when run in optimized mode

I have to use some legacy .pyc modules (with no source) but I'm also forced to use python in optimized mode (python -O): so, when trying to import those modules, I get an import error (as python looks for .py or .pyo files).

Is there a way to make it use pyc modules as well? Or to convert .pyc into .开发者_开发百科pyo?


One way to "convert" them is simply renaming them. Of course they won't be optimised, but at least you can use them.


You can use DePython to convert your .pyc files into .py files, and then you will be able to import them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜