简体   繁体   English

如何在Microsoft Visual Studio Community 2017中将.py编译为.exe?

[英]How to compile .py to .exe in Microsoft Visual Studio Community 2017?

How do you compile .py to .exe in Microsoft Visual Studio 2017? 如何在Microsoft Visual Studio 2017中将.py编译为.exe? I have looked through the menus but can not find what I'm looking for? 我已经浏览过菜单,但是找不到我想要的东西?

Hey Tom! 嘿汤姆!

You can compile it, but only into a .pyc file which is a compiled python file, which I do not know what it does. 您可以将其编译,但只能编译为.pyc文件,该文件是已编译的python文件,我不知道它的作用。 I personally chose to installed pyinstaller, and ran pyinstaller [filename].py from the command line. 我个人选择安装pyinstaller,并pyinstaller [filename].py运行pyinstaller [filename].py It is easier than py2exe. 它比py2exe更容易。

Python is usually not compiled but executed using the python interpreter. Python通常不会编译,而是使用python解释器执行。

You should only ever compile it to an .exe if you want to execute it on windows without having to install python first. 如果只想在Windows上执行它而不必先安装python,则应该只将其编译为.exe。 That can be done by using pyinstaller or py2exe (in case you use python 2). 这可以通过使用pyinstaller或py2exe来完成(如果使用python 2)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM