如何在macOS上打开PYW文件 [英] How to open PYW files on macOS

查看:102
本文介绍了如何在macOS上打开PYW文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我是Python的新手.我刚刚从 http://webprojects.eecs.qmul下载了一个文件.ac.uk/fa303/pgs/tutorial.html .这是一个PYW文件.这是游戏超级马里奥兄弟的重制.我已经安装了Python 3和Pygame.该文件夹位于我的桌面上,目前我正在尝试弄清楚如何运行该游戏进行测试.

So, I am extremely new to Python. I just downloaded a file from http://webprojects.eecs.qmul.ac.uk/fa303/pgs/tutorial.html. It is a PYW file. It is a recreation of the game Super Mario Brothers. I have Python 3 and Pygame already installed. The folder is on my desktop, and I am currently trying to figure out how I can run the game for a test.

谢谢.

推荐答案

如果在Windows上,请从"cmd.exe"运行命令"pythonw(PYW文件的名称)".PYW文件不需要cmd.exe,因此可以将其关闭.
如果您使用的是Linux或Mac OS X,只需将PYW"example.PY"文件重命名为PY文件,然后从控制台运行它.不要在这里关闭控制台,因为它不再是PYW文件.有关说明,请向下滚动.

说明:

If you are on Windows, run the command "pythonw (name of PYW file)" from "cmd.exe". PYW files don't need cmd.exe so you can close out of it.
If you are on Linux or Mac OS X, just rename the PYW"example.PY" file to a PY file and run it from the console. Don't close the console here because it is no longer a PYW file. For the explanations, scroll down.

Explanations:

PYW文件仅表示没有控制台的Python脚本".因此,运行PYW文件不会显示控制台,但是运行PY文件却可以显示控制台.PYW文件仅在Windows中有效,而在Mac和Linux系统中不可用.

PYW files are just meant "Python Script Without Console". So running a PYW file will not show the console but running a PY file do show a console. PYW files only work in Windows and are not available in Mac and Linux systems.

这篇关于如何在macOS上打开PYW文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆