Python 无限 While 循环导致 Mac 崩溃

发布于 2024-10-04 14:51:33 字数 157 浏览 5 评论 0原文

我有一个带有循环的 python 脚本,例如

while True:
    #do something here

每当我运行它时,它都会使 mac 崩溃。 Mac 运行 Mac OS X 10.6.5 和 python 2.6.1

I have a python script with a loop such as

while True:
    #do something here

Whenever i run it, it will crash the mac.
The mac runs Mac OS X 10.6.5 and python 2.6.1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

明月夜 2024-10-11 14:51:33

如果您可以编写任何无限循环并且导致崩溃,那么您的操作系统或 Python 可能有问题(因为这通常不会导致崩溃)。尝试一下 MacPorts Python 发行版,希望您不会遇到同样的问题。

If you can write any infinite loop and it causes a crash, then you either have a problem with your OS or your Python (since this doesn't normally cause a crash). Try out the MacPorts Python distribution and hopefully you won't have the same problems.

甜`诱少女 2024-10-11 14:51:33

当您让计算机在 100% CPU 上运行太长时间时,可能会导致计算机过热。解决方案是确保 CPU 上的风扇正常工作或安装更好的风扇。

Maybe your computer is overheating when you let it run on 100% CPU for too long. The solution then would be make sure the fan on your CPU works or to get a better one installed.

等往事风中吹 2024-10-11 14:51:33

既然您说 Python 2.6.1 与 OS X 10.6,我假设您使用的是 Apple 提供的 Python 2.6。如果您的计算机支持 64 位,则 Python 默认情况下将在 64 位模式下运行,这可能会对堆栈相关问题产生影响。您可以尝试在32位模式下运行,看看是否会出现同样的情况;您可以通过以下方式调用 Python 来做到这一点:

$ arch -i386 /usr/bin/python2.6

您还可以尝试使用 OS X 的 python.org 安装程序安装最新的 Python 2.6 (2.6.6) 此处。注意:Python 仅支持 32 位。 (顺便说一下,Python 2.7 现在是最新版本。如果您可以用它重现问题,您应该在 Python 上打开一个问题错误跟踪器。)

Since you say Python 2.6.1 with OS X 10.6, I assume you are using the Apple-supplied Python 2.6. If your machine is 64-bit capable, that Python will by default run in 64-bit mode which could have an impact on stack-related issues. You could try running in 32-bit mode and see if the same thing happens; you can do that by invoking Python this way:

$ arch -i386 /usr/bin/python2.6

You could also try installing the most recent Python 2.6 (2.6.6) using the python.org installer for OS X here. Note: that Python is 32-bit only. (By the way, Python 2.7 is now current. If you can reproduce the problem with it, you should open an issue on the Python bug tracker.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文