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. 酸了!看到抖音上Python程序员晒得工资条......
  3. Python基础之:数字字符串和列表
  4. Importing excel into database adaptively by Python
  5. Python安装教程
  6. Python安装教程
  7. From Xiaobai to master, here is a guide to pandas
  8. [Python] drawing method of stem leaf diagram and compound pie diagram
  9. Drawing of Python geoplot spatial kernel density estimation map
  10. Python Seaborn economist's classic chart imitation
  11. Python space drawing - regionmask mask operation example
  12. Python space drawing - cartopy longitude and latitude add
  13. Python pykrige package Kriging interpolation calculation and visual rendering
  14. Python batch resampling, mask, slope extraction
  15. Python - Analysis of reachable circle of multiple traffic modes
  16. Python space drawing bubble drawing
  17. Python 3 multithreading and Mongo 100 million consumption log data fresh demo
  18. ARIMA model for predicting time series of CO2 concentration
  19. python isinstance()
  20. How to modify tens of thousands of file names with one key in Python
  21. Python notes: List
  22. Translation: practical Python Programming 02_ 03_ Formatting
  23. Python中的四种队列(queue)、堆(heap)
  24. Side effects of Python mutable types as default parameters of functions
  25. This is the best Python tutorial I've ever seen: ten minutes to get to know python
  26. 使用python编写量子线路打印的简单项目,并使用Sphinx自动化生成API文档
  27. Python happy enemy: crawler and anti crawler with a solution to give you New Year
  28. 使用python编写量子线路打印的简单项目,并使用Sphinx自动化生成API文档
  29. When writing python, you will encounter the following error: modulenotfounderror: no module named ' email.mime '; 'email' is not a package
  30. Python class call and private and public property method call
  31. Proprietary methods for Python classes
  32. Foundation of Python: number string and list
  33. Foundation of Python: number string and list
  34. Foundation of Python: number string and list
  35. 华为 Python网络自动化
  36. Python Cannot open E:\Python36\Scripts\pip-script.py
  37. Peeping into the future is not a dream, python data analysis is easy to achieve
  38. The practical skills summed up by Alibaba and Huawei Python engineers, only you haven't seen them yet?
  39. Sour! See the Python programmers on the tiktok get the pay slip...
  40. Foundation of Python: number string and list
  41. Python installation tutorial
  42. Python installation tutorial
  43. This article will familiarize you with the transformation process of Python - > Cafe - > om model
  44. Four kinds of queues and heaps in Python
  45. Using Python to write a simple project of quantum circuit printing, and using Sphinx to automatically generate API documents
  46. Using Python to write a simple project of quantum circuit printing, and using Sphinx to automatically generate API documents
  47. Huawei Python Network Automation
  48. Python Cannot open E:\Python36\Scripts\pip- script.py
  49. 找不到Python问题解决
  50. PHP和Python哪个更有市场前景?我学的是PHP
  51. Python problem resolution not found
  52. Which has more market prospects, PHP or Python? I studied PHP
  53. Foundation of Python: number string and list
  54. python 编码问题之终极解决
  55. The ultimate solution to the problem of Python coding
  56. 能取值亦能赋值的Python切片
  57. Python slice with value and value
  58. 能取值亦能赋值的Python切片
  59. Python slice with value and value
  60. python 异常处理