【问题标题】:How to package all the required libraries with the python program so that it can run in all systems?如何用python程序打包所有需要的库,使其可以在所有系统中运行?
【发布时间】:2019-01-09 05:29:00
【问题描述】:

我刚刚在 python 上制作了一个tkinter 小部件。我想把它传给我有 python 但没有tkinter 库的朋友。

他现在正在收到module not found error

【问题讨论】:

    标签: python import module automation package


    【解决方案1】:

    这假定您的终端位于项目所在的当前目录中。 您必须在终端上运行pip freeze 以列出已安装的库并将输出保存在requirements.txt 上。在基于 unix 的操作系统上,您可以运行 pip freeze > requirements.txt,使库自动保存在 requirements.txt 中。要安装来自requirements.txt 的库,您可以运行pip install -r requirements.txt

    如果您有使用虚拟环境的背景会更好。

    【讨论】:

      【解决方案2】:

      访问THIS 链接。它将为您提供将 .py 文件转换为可分发的 .exe 文件所需的东西。

      【讨论】:

        猜你喜欢
        • 2020-11-03
        • 2016-09-05
        • 1970-01-01
        • 1970-01-01
        • 2012-08-04
        • 2016-12-25
        • 2020-08-22
        • 2023-01-04
        • 2017-08-21
        相关资源
        最近更新 更多