python - 如何将多个 py 文件编译为一个文件?

标签 python module compilation maya pyc

我是 Python 的新手,完全不知道从哪里开始完成这项工作。

我编写了许多需要编译到单个 .pyc 文件中的小模块(maya 工具集)。是否有一个模块可以做到这一点?或者你能告诉我从哪里开始吗?教程?我什至不知道要查找什么术语。

最佳答案

您甚至不需要制作鸡蛋,只需压缩您的文件并将压缩文件放入您的 python 路径即可。 Maya 的 python 版本默认包含 zipimport 模块,因此只要 maya 可以找到您的 zip 文件,它就“正常工作”。

以下是您可能会发现有用的工具分发整个主题的一些讨论:

http://tech-artists.org/forum/showthread.php?3271-Distribution-techniques-for-external-Python-tools&highlight=distribute

http://tech-artists.org/forum/showthread.php?3987-Maya-GitHub-and-Script-Paths-for-Mel-and-Python-How-Would-You-Do-It&highlight=distribute

http://tech-artists.org/forum/showthread.php?3752-Best-Way-to-Share-Your-Scripts&highlight=distribution

关于python - 如何将多个 py 文件编译为一个文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29751003/

相关文章:

Python:为什么模块中不允许出现 `return`

Python 守护进程使用相同的对象列表

python - 将模块添加到 pythonpath - 没有任何作用

python - 在 CherryPy 中使用映射

angular - 当命令 ngserve 显示模块未找到时,Angular 中出现错误

c++ - 抽象对象不能声明

C++/R : RInside in Windows 7 machine

css - 自动编译在 less 中不起作用

python - Qt WebEngine 中 QWebInspector 的替代品是什么?

python - 高斯算法显示意外行为