Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将python gui程序存储为桌面应用程序?_Python_Selenium_User Interface_Desktop Application - Fatal编程技术网

如何将python gui程序存储为桌面应用程序?

如何将python gui程序存储为桌面应用程序?,python,selenium,user-interface,desktop-application,Python,Selenium,User Interface,Desktop Application,因此,我编写了一个包含gui的pyhton程序,如何将该程序转换为桌面应用程序,在不打开文本编辑器并执行的情况下打开它。代码如下(当我在gui中输入视频名称时,它会在youtube上查找并在结果页面中播放第一个视频) ```from selenium import webdriver from tkinter import * root=Tk() root.title('Youtube Video Player') text=Label(root,text="In or

因此,我编写了一个包含gui的pyhton程序,如何将该程序转换为桌面应用程序,在不打开文本编辑器并执行的情况下打开它。代码如下(当我在gui中输入视频名称时,它会在youtube上查找并在结果页面中播放第一个视频)

```from selenium import webdriver
   from tkinter import * 
   root=Tk()
   root.title('Youtube Video Player')
   text=Label(root,text="In order to save time and avoid procrastination.\nEnter the name of the 
   video you have in mind,and by the power of the gods it will play")
   text.pack()
   input=Entry()
   input.pack()
   def vidplayer():
           a=str(input.get())
           browser=webdriver.Chrome('C:\\Users\\lenovo\\Downloads\\chromedriver')
           browser.get('https://www.youtube.com/results?search_query='+a)
           video=browser.find_element_by_id('video-title')
           video.click()
   button=Button(text="Play Video", command=vidplayer)
   button.pack()
   root.mainloop()```

您可以使用类似的工具将python代码打包到特定操作系统本机的可执行文件中。

您可以使用类似的工具将python代码打包到特定操作系统本机的可执行文件中。

听起来您想“冻结”代码。那里有很多配电设施。您可以从官方文档开始


我在cxFreeze和PyInstaller方面都取得了很大成功。

听起来您想“冻结”代码。那里有很多配电设施。您可以从官方文档开始


我在cxFreeze和PyInstaller方面都取得了很大的成功。

我尝试了PyInstaller,但是包含.exe的dist文件是空的。您是否在命令行上收到任何错误或警告?能否在命令行上成功运行脚本?我将上面的代码复制/粘贴到一个名为test.py的脚本中,然后运行pyinstaller test.py,在dist/test中有一个可运行的exe和所有支持文件。错误:为cx\U冻结构建控制盘失败即使我之前安装了控制盘,它仍然没有“不行。我认为Python3.7不支持cx_freeze版本,也许我必须降低我的python版本8月份的cx_freeze v6与Python3.7一起工作。如果您没有v6,请尝试此操作,否则如果粘贴错误的完整输出(将很长),我们可能可以查看是否缺少依赖项或其他问题。我尝试过pyinstaller,但包含.exe的dist文件为空。您是否在命令行上收到任何错误或警告?能否在命令行上成功运行脚本?我将上面的代码复制/粘贴到一个名为test.py的脚本中,然后运行pyinstaller test.py,在dist/test中有一个可运行的exe和所有支持文件。错误:为cx\U冻结构建控制盘失败即使我之前安装了控制盘,它仍然没有“不行。我认为Python3.7不支持cx_freeze版本,也许我必须降低我的python版本8月份的cx_freeze v6与Python3.7一起工作。如果您没有v6,请尝试这样做,否则如果粘贴错误的完整输出(它将很长),我们可能会看到是否缺少依赖项或其他问题。