5个无聊Python程序,用Python整蛊你的朋友们吧

爱学习的豆包 2021-02-23 10:57:14
Python pyinstaller dwz


<section id="nice" data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="font-size: 16px; color: black; padding: 0 10px; line-height: 1.6; word-spacing: 0px; letter-spacing: 0px; word-break: break-word; word-wrap: break-word; text-align: left; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;"><p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">Python 能做很多无聊,但有意思的事情,例如接下来的一些案例。</p> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">以下程序,不要发代码,要不实现不了你整蛊的目的。</p> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">要打包成一个 exe 程序,发给朋友才有意思。</p> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">使用 pip install pyinstaller。</p> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">打包命令如下:</p> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">pyinstaller&nbsp;-F&nbsp;文件名.py<br></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">过程中如果出现 BUG(一般是编码错误),文末有解决方案</p> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"><strong style="font-weight: bold; color: black;">无聊程序之一</strong></p> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;"><span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">while</span>&nbsp;True:<br>&nbsp;&nbsp;n&nbsp;=&nbsp;input(<span class="hljs-string" style="color: #98c379; line-height: 26px;">"猜猜我在想啥?"</span>)<br>&nbsp;&nbsp;<span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">print</span>(<span class="hljs-string" style="color: #98c379; line-height: 26px;">"猜错喽"</span>)<br></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">你的朋友将永远无法知道你在想什么。</p> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">当然我安装 360 之后,程序没了。有兴趣研究免杀的,可以在给本文点个赞,点赞过 100,我出套 Python 免杀教程。</p> <figure data-tool="mdnice编辑器" style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://static01.imgkr.com/temp/7e0c1bc51cca45f78967601a70f7be85.png" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"><strong style="font-weight: bold; color: black;">无聊程序之二</strong></p> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">死命弹窗</p> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">import&nbsp;tkinter.messagebox<br><br><span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">while</span>&nbsp;True:<br>&nbsp;&nbsp;&nbsp;&nbsp;tkinter.messagebox.showerror(<span class="hljs-string" style="color: #98c379; line-height: 26px;">'Windows&nbsp;错误'</span>,<span class="hljs-string" style="color: #98c379; line-height: 26px;">'你的电脑正在被攻击!'</span>)<br></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">运行之后,很就刺激了,如果对方不会杀进程,更刺激。</p> <figure data-tool="mdnice编辑器" style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://imgkr2.cn-bj.ufileos.com/a53df547-1cf2-4051-89d0-84a39d76db28.png?UCloudPublicKey=TOKEN_8d8b72be-579a-4e83-bfd0-5f6ce1546f13&amp;Signature=p6gkOWvU2S91W8HDVGZYx%252FqbON0%253D&amp;Expires=1614130142" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"><strong style="font-weight: bold; color: black;">无聊程序之三</strong></p> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">调用默认浏览器,无限打开 CSDN ,让他爱上学习。</p> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">import&nbsp;webbrowser<br><span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">while</span>&nbsp;True:<br>&nbsp;&nbsp;&nbsp;&nbsp;webbrowser.open(<span class="hljs-string" style="color: #98c379; line-height: 26px;">'www.csdn.net'</span>)<br></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">额,使用之后,我自己的电脑死机了。</p> <figure data-tool="mdnice编辑器" style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://static01.imgkr.com/temp/cabe293b984448e5b1f4b94d27ee0124.png" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">瞬间 CPU…</p> <figure data-tool="mdnice编辑器" style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://static01.imgkr.com/temp/c3f5f69d01f346b99121d6e12fa84a02.png" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"><strong style="font-weight: bold; color: black;">无聊程序之四</strong></p> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">这个程序就动感多了,会随机出现弹窗。</p> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">import&nbsp;tkinter&nbsp;as&nbsp;tkimport&nbsp;randomimport&nbsp;threadingimport&nbsp;timedef&nbsp;boom():window&nbsp;=&nbsp;tk.Tk()&nbsp;&nbsp;&nbsp;&nbsp;width&nbsp;=&nbsp;window.winfo_screenwidth()&nbsp;&nbsp;&nbsp;&nbsp;height&nbsp;=&nbsp;window.winfo_screenheight()&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;=&nbsp;random.randrange(0,&nbsp;width)&nbsp;&nbsp;&nbsp;&nbsp;b&nbsp;=&nbsp;random.randrange(0,&nbsp;height)window.title(<span class="hljs-string" style="color: #98c379; line-height: 26px;">'你是一个傻狍子'</span>)window.geometry(<span class="hljs-string" style="color: #98c379; line-height: 26px;">"200x50"</span>&nbsp;+&nbsp;<span class="hljs-string" style="color: #98c379; line-height: 26px;">"+"</span>&nbsp;+&nbsp;str(a)&nbsp;+&nbsp;<span class="hljs-string" style="color: #98c379; line-height: 26px;">"+"</span>&nbsp;+&nbsp;str(b))&nbsp;&nbsp;&nbsp;&nbsp;tk.Label(window,&nbsp;text=<span class="hljs-string" style="color: #98c379; line-height: 26px;">'你是一个傻狍子'</span>,&nbsp;<span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">bg</span>=<span class="hljs-string" style="color: #98c379; line-height: 26px;">'green'</span>,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font=(<span class="hljs-string" style="color: #98c379; line-height: 26px;">'宋体'</span>,&nbsp;17),&nbsp;width=20,&nbsp;height=4).pack()window.mainloop()threads&nbsp;=&nbsp;[]<span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">for</span>&nbsp;i&nbsp;<span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">in</span>&nbsp;range(100):&nbsp;&nbsp;&nbsp;&nbsp;t&nbsp;=&nbsp;threading.Thread(target=boom)&nbsp;&nbsp;&nbsp;&nbsp;threads.append(t)&nbsp;&nbsp;&nbsp;&nbsp;time.sleep(0.1)&nbsp;&nbsp;&nbsp;&nbsp;threads[i].start()<br></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">运行效果如下图所示,非常带劲,可以任意修改。</p> <figure data-tool="mdnice编辑器" style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://imgkr2.cn-bj.ufileos.com/4f3d5114-797b-4b46-8a01-b694b07ff5ce.png?UCloudPublicKey=TOKEN_8d8b72be-579a-4e83-bfd0-5f6ce1546f13&amp;Signature=5D%252F5oa5seOXCqdjbGFt7EooVMc0%253D&amp;Expires=1614130215" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"><strong style="font-weight: bold; color: black;">无聊程序之五</strong></p> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">该程序在我看来能排到第一,甚至可以和当下最火的枪茅台案例结合一下。</p> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">import&nbsp;osimport&nbsp;timea&nbsp;=&nbsp;<span class="hljs-string" style="color: #98c379; line-height: 26px;">""</span><span class="hljs-string" style="color: #98c379; line-height: 26px;">"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oooo&nbsp;oooooooooo.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.oooooo..o&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oooo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;o8o&nbsp;&nbsp;oooo&nbsp;&nbsp;oooo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`888&nbsp;`888'&nbsp;&nbsp;&nbsp;`Y8b&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;d8P'&nbsp;&nbsp;&nbsp;&nbsp;`Y8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"</span><span class="hljs-string" style="color: #98c379; line-height: 26px;">'&nbsp;&nbsp;`888&nbsp;&nbsp;`888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Y88bo.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.ooooo.&nbsp;&nbsp;&nbsp;.ooooo.&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;oooo&nbsp;&nbsp;oooo&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"Y8888o.&nbsp;&nbsp;d88'</span>&nbsp;`88b&nbsp;d88<span class="hljs-string" style="color: #98c379; line-height: 26px;">'&nbsp;`"Y8&nbsp;&nbsp;888&nbsp;.8P'</span>&nbsp;&nbsp;&nbsp;`888&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;888&nbsp;8888888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`<span class="hljs-string" style="color: #98c379; line-height: 26px;">"Y88b&nbsp;888ooo888&nbsp;888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;888888.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;d88'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.d8P&nbsp;888&nbsp;&nbsp;&nbsp;&nbsp;.o&nbsp;888&nbsp;&nbsp;&nbsp;.o8&nbsp;&nbsp;888&nbsp;`88b.&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;888&nbsp;&nbsp;&nbsp;888.o.&nbsp;88P&nbsp;o888bood8P'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8"</span><span class="hljs-string" style="color: #98c379; line-height: 26px;">"88888P'&nbsp;&nbsp;`Y8bod8P'&nbsp;`Y8bod8P'&nbsp;o888o&nbsp;o888o&nbsp;o888o&nbsp;o888o&nbsp;o888o`Y888P功能列表:1.预约商品2.秒杀抢购商品"</span><span class="hljs-string" style="color: #98c379; line-height: 26px;">""</span><span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">print</span>(a)key&nbsp;=&nbsp;input(<span class="hljs-string" style="color: #98c379; line-height: 26px;">"请选择:"</span>)<span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">if</span>&nbsp;key&nbsp;==&nbsp;<span class="hljs-string" style="color: #98c379; line-height: 26px;">"1"</span>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;time.sleep(1.5)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">print</span>(<span class="hljs-string" style="color: #98c379; line-height: 26px;">'没有预约到\n'</span>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;time.sleep(3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">print</span>(<span class="hljs-string" style="color: #98c379; line-height: 26px;">'没事的,来抱一哈\n'</span>)<span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">else</span>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">print</span>(<span class="hljs-string" style="color: #98c379; line-height: 26px;">"既然如此..."</span>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;time.sleep(3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">print</span>(<span class="hljs-string" style="color: #98c379; line-height: 26px;">"那你想得美~~~~~"</span>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;os.system(<span class="hljs-string" style="color: #98c379; line-height: 26px;">'shutdown&nbsp;-r&nbsp;-t&nbsp;10'</span>)time.sleep(10)<br></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">别运行,运行之后别怪我。</p> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">pyinstaller 编码 BUG</p> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">在使用 pyinstaller 进行打包 exe 的时候,会出现如下错误:</p> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">&nbsp;&nbsp;File&nbsp;<span class="hljs-string" style="color: #98c379; line-height: 26px;">"c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\utils\hooks\__init__.py"</span>,&nbsp;line&nbsp;68,&nbsp;<span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">in</span>&nbsp;__exec_python_cmd<br>&nbsp;&nbsp;&nbsp;&nbsp;txt&nbsp;=&nbsp;exec_python(*cmd,&nbsp;env=pp_env)<br>&nbsp;&nbsp;File&nbsp;<span class="hljs-string" style="color: #98c379; line-height: 26px;">"c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\compat.py"</span>,&nbsp;line&nbsp;526,&nbsp;<span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">in</span>&nbsp;exec_python<br><span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">return</span>&nbsp;exec_command(*cmdargs,&nbsp;**kwargs)<br>&nbsp;&nbsp;File&nbsp;<span class="hljs-string" style="color: #98c379; line-height: 26px;">"c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\compat.py"</span>,&nbsp;line&nbsp;321,&nbsp;<span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">in</span>&nbsp;exec_command<br>out&nbsp;=&nbsp;out.decode(encoding)<br>AttributeError:&nbsp;<span class="hljs-string" style="color: #98c379; line-height: 26px;">'str'</span>&nbsp;object&nbsp;has&nbsp;no&nbsp;attribute&nbsp;<span class="hljs-string" style="color: #98c379; line-height: 26px;">'decode'</span><br></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">截图如下:</p> <figure data-tool="mdnice编辑器" style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://imgkr2.cn-bj.ufileos.com/dc64b57c-0b00-42ea-a248-6d9f52d1dd5c.png?UCloudPublicKey=TOKEN_8d8b72be-579a-4e83-bfd0-5f6ce1546f13&amp;Signature=NDjThomTbgyi%252Fh230gmR1JkkoKE%253D&amp;Expires=1614130335" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">按照 BUG 提示的位置,修改下述代码:</p> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">out&nbsp;=&nbsp;out.decode(encoding)&nbsp;<span class="hljs-comment" style="color: #5c6370; font-style: italic; line-height: 26px;">#&nbsp;改为&nbsp;&nbsp;out&nbsp;=&nbsp;out</span><br></code></pre> <p data-tool="mdnice编辑器" style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">打包成功在 dist 文件中找寻 exe 程序即可。</p> <figure data-tool="mdnice编辑器" style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://static01.imgkr.com/temp/9aba52ec84c842ed8c5b0b2634f0c1d1.png" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> </section> [拿走不谢!Python 3.9 官方中文文档,限时领!] (http://dwz.date/dE6v)

[限时!速领!14张高清Python速查表,效率提升必备!] (http://dwz.date/dE6w)

[GitHub标星3W+,80个Python案例,带你轻松玩转Python学习!] (http://dwz.date/dE64)

版权声明
本文为[爱学习的豆包]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4630617/blog/4959946

  1. 利用Python爬虫获取招聘网站职位信息
  2. Using Python crawler to obtain job information of recruitment website
  3. Several highly rated Python libraries arrow, jsonpath, psutil and tenacity are recommended
  4. Python装饰器
  5. Python实现LDAP认证
  6. Python decorator
  7. Implementing LDAP authentication with Python
  8. Vscode configures Python development environment!
  9. In Python, how dare you say you can't log module? ️
  10. 我收藏的有关Python的电子书和资料
  11. python 中 lambda的一些tips
  12. python中字典的一些tips
  13. python 用生成器生成斐波那契数列
  14. python脚本转pyc踩了个坑。。。
  15. My collection of e-books and materials about Python
  16. Some tips of lambda in Python
  17. Some tips of dictionary in Python
  18. Using Python generator to generate Fibonacci sequence
  19. The conversion of Python script to PyC stepped on a pit...
  20. Python游戏开发,pygame模块,Python实现扫雷小游戏
  21. Python game development, pyGame module, python implementation of minesweeping games
  22. Python实用工具,email模块,Python实现邮件远程控制自己电脑
  23. Python utility, email module, python realizes mail remote control of its own computer
  24. 毫无头绪的自学Python,你可能连门槛都摸不到!【最佳学习路线】
  25. Python读取二进制文件代码方法解析
  26. Python字典的实现原理
  27. Without a clue, you may not even touch the threshold【 Best learning route]
  28. Parsing method of Python reading binary file code
  29. Implementation principle of Python dictionary
  30. You must know the function of pandas to parse JSON data - JSON_ normalize()
  31. Python实用案例,私人定制,Python自动化生成爱豆专属2021日历
  32. Python practical case, private customization, python automatic generation of Adu exclusive 2021 calendar
  33. 《Python实例》震惊了,用Python这么简单实现了聊天系统的脏话,广告检测
  34. "Python instance" was shocked and realized the dirty words and advertisement detection of the chat system in Python
  35. Convolutional neural network processing sequence for Python deep learning
  36. Python data structure and algorithm (1) -- enum type enum
  37. 超全大厂算法岗百问百答(推荐系统/机器学习/深度学习/C++/Spark/python)
  38. 【Python进阶】你真的明白NumPy中的ndarray吗?
  39. All questions and answers for algorithm posts of super large factories (recommended system / machine learning / deep learning / C + + / spark / Python)
  40. [advanced Python] do you really understand ndarray in numpy?
  41. 【Python进阶】Python进阶专栏栏主自述:不忘初心,砥砺前行
  42. [advanced Python] Python advanced column main readme: never forget the original intention and forge ahead
  43. python垃圾回收和缓存管理
  44. java调用Python程序
  45. java调用Python程序
  46. Python常用函数有哪些?Python基础入门课程
  47. Python garbage collection and cache management
  48. Java calling Python program
  49. Java calling Python program
  50. What functions are commonly used in Python? Introduction to Python Basics
  51. Python basic knowledge
  52. Anaconda5.2 安装 Python 库(MySQLdb)的方法
  53. Python实现对脑电数据情绪分析
  54. Anaconda 5.2 method of installing Python Library (mysqldb)
  55. Python implements emotion analysis of EEG data
  56. Master some advanced usage of Python in 30 seconds, which makes others envy it
  57. python爬取百度图片并对图片做一系列处理
  58. Python crawls Baidu pictures and does a series of processing on them
  59. python链接mysql数据库
  60. Python link MySQL database