【问题标题】:Is there a way to make a .exe on a virtual environment using kivy?有没有办法使用 kivy 在虚拟环境中制作 .exe?
【发布时间】:2021-11-25 07:10:18
【问题描述】:

创建虚拟环境后,我将我的 python 文件放在文件夹中,在该文件位置打开我的命令提示符并执行:pyinstaller helloworld.py

这将成功创建文件。当我打开文件夹“dist”然后导航到 helloworld.exe 我是下一个文件夹,我运行它并关闭它。我按照建议在 helloworld.py 中添加了一个输入,但是当我更新所有内容并运行 helloworld.exe 时,它​​只会保持打开足够长的时间来输入然后关闭。没有错误。我知道 kivy 正在流产,但我不知道为什么。谁能帮我弄清楚为什么?

import kivy
from kivy.app import App from
from kivy.uix.label import Label

class MyApp(App):
def build(self):
    return Label(text='Hello world')

if __name__ == '__main__':
      MyApp().run()

【问题讨论】:

    标签: python kivy pyinstaller


    【解决方案1】:

    您可能需要先激活虚拟环境 (ven)。

    `Open cmd
    cd into program_folder/venv/bin
    "activate.bat" 
    
    cd back to folder with .py
    
    pyinstaller .py`
    

    任何时候你想在 cmd 会话中使用你的 venv,你都需要这样做。

    【讨论】:

      猜你喜欢
      • 2023-02-16
      • 1970-01-01
      • 2018-01-30
      • 2017-02-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-01
      • 1970-01-01
      相关资源
      最近更新 更多