折腾一下午,终于解决了这个问题,有必要记录一下,我就奇怪了为什么实验室电脑没问题,到宿舍就挂掉了,哼
主要是改mimetypes文件,位于D:MySoftwarePython27Lib下
1、添加代码
在mimetypes.py文件中找到 “default_encoding = sys.getdefaultencoding()”
在该代码之上添加
if sys.getdefaultencoding() != 'utf-8': reload(sys) sys.setdefaultencoding('utf-8')
2、注释代码
大概在mimetypes.py的248行,找到代码并将其注释,如下
def enum_types(mimedb): i = 0 while True: try: ctype = _winreg.EnumKey(mimedb, i) except EnvironmentError: break #try: # ctype = ctype.encode(default_encoding) # omit in 3.x! #except UnicodeEncodeError: # pass #else: yield ctype i += 1
然后就好了,终于可以在win8下,在我的小本本下愉快地写python啦