开发者

Can I have scripts outside my python exe?

开发者 https://www.devze.com 2023-03-18 06:40 出处:网络
I\'m new to Python and starting to learn it.However I have one query, which I\'d like to know for the future.

I'm new to Python and starting to learn it. However I have one query, which I'd like to know for the future.

Onc开发者_StackOverflow社区e I've made a python program and produced an exe via py2exe, is it then possible to execute python scripts outside of the exe or do I have to look at plugins?


Yes, it is entirely possible. It's a standard Python interpreter. You'll need to put the directory in sys.path so that the filesystem importer will pick it up. And then for runtime imports generally using the __import__ function will be the easiest way.

A Google search for "py2exe runtime import" provides early in the results one example of it: http://www.velocityreviews.com/forums/t330613-py2exe-excluding-a-module-and-import-it-during-runtime-how.html

0

精彩评论

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