Pyscripter为什么总报错?UnicodeEncodeError:'ascii' codec can't encode characters in position 1-2:安装了python2.6.6 /2.7pyscripter2.1.1.0代码:def main():passif __name__ == '__main__':main()运行报错UnicodeEncodeError:'ascii' codec can't e

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/29 01:44:41
Pyscripter为什么总报错?UnicodeEncodeError:''ascii''codeccan''tencodecharactersinposition1-2:安装了python2.6.6/2.

Pyscripter为什么总报错?UnicodeEncodeError:'ascii' codec can't encode characters in position 1-2:安装了python2.6.6 /2.7pyscripter2.1.1.0代码:def main():passif __name__ == '__main__':main()运行报错UnicodeEncodeError:'ascii' codec can't e
Pyscripter为什么总报错?UnicodeEncodeError:'ascii' codec can't encode characters in position 1-2:
安装了python2.6.6 /2.7
pyscripter2.1.1.0
代码:
def main():
pass
if __name__ == '__main__':
main()
运行报错
UnicodeEncodeError:'ascii' codec can't encode characters in position 1-2:ordinal not in range(128)
把python换成3.1.2 就没问题了.
可以运行.
因为想用py2.X 比较流行.所以还是想用py2.X ..
谁知道怎么解决上面的办法..
好像和 encode 什么的无关..
joy32812 按照你说的改完了的确没有上述问题了.把程序移动到其他电脑上不会出错吧.

Pyscripter为什么总报错?UnicodeEncodeError:'ascii' codec can't encode characters in position 1-2:安装了python2.6.6 /2.7pyscripter2.1.1.0代码:def main():passif __name__ == '__main__':main()运行报错UnicodeEncodeError:'ascii' codec can't e
在你python的安装目录下的Lib目录,找到site.py,修改def setencoding()方法
def setencoding():
.
.
if 0:
# Enable to support locale aware default string encodings.
把那个if 0该位if 1试试.
还有就是最好文件目录中不要出现中文.