我怎么不能让这个.exe与Pyinstaller合作?
我正在尝试与Pycharm和Pyinstaller一起玩,因为我对Python非常陌生,并且正在尝试创建一个.exe文件,该文件只是从网站上显示了一大堆育儿HTML,只是为了进行测试。我把它在pycharm中工作了,但是当我以exe的身份运行它时,它只是打开并关闭空白的控制台。我使用:
pyinstaller.exe -onefile -windowed main.py
(main是文件名)。
这是代码:
from bs4 import BeautifulSoup
import requests
Url = "https://www.premierleague.com/players/5178/Mohamed-Salah/stats"
DisplayText = ""
Request = requests.get(Url)
Htmlcode = BeautifulSoup(Request.text, "html.parser")
search = Htmlcode.findAll(text="Goals ")
narrow = search[0].parent
input(narrow)
我也认为,但是我不确定,Windows安全是否会搞砸了,但我不确定。
I am trying to just play around with Pycharm and Pyinstaller as I am very new to python and am trying to create a .exe file that simply displays a chunk of parented html from a website, just to test. I got it to work within Pycharm but when I run it as an exe, it just opens and closes a blank console. I created the exe using:
pyinstaller.exe --onefile --windowed main.py
(main is the file name).
Here is the code:
from bs4 import BeautifulSoup
import requests
Url = "https://www.premierleague.com/players/5178/Mohamed-Salah/stats"
DisplayText = ""
Request = requests.get(Url)
Htmlcode = BeautifulSoup(Request.text, "html.parser")
search = Htmlcode.findAll(text="Goals ")
narrow = search[0].parent
input(narrow)
also I think, but I am not sure, windows security may be screwing with this but I am not sure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以pyinstaller而不是pyinstaller.exe运行,除非是错别字检查的最后一行,否则输入(窄)之后(狭窄)将导致错误
编辑:
像没有 - 窗口一样运行
,不需要 - 窗口标签,这就是导致错误的原因
Try running as pyinstaller instead of pyinstaller.exe, and unless it's a typo check the last line of code, ''' after the input(narrow) would cause an error
EDIT:
run as
without the --windowed, there's no need for the --windowed tag and that's what's causing the error