简体   繁体   中英

Error when running simple python script

When I run the following:

import sys

if __name__ == '__main__':
    print 'before exit'
    sys.exit(0)

The output is:

before exit
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):

I don't know why the exception occurs, but it was suggested that it could be an improper installation of Python. I was wondering if anyone knew of a way to fix this? I am running Windows 7 x64, but with an x32 install of everything.

I agree with the commenters that suggest you have a bad python install (an exception thrown running something so simple is a clear indication of corruption). But reinstalling need not be painful.

Here's what I would do.

First, rename your python directory (on windows its something like c:\\python2.x)

Next, install fresh copy of python (be sure it's the same version you already were running)

Finally, copy the Site-packages folder from previous installation into the new install.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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