Python开发脚本的时候遇到的问题总结

pyinstaller 打包的时候,递归过深

解决方法:
将生成的xxx.spec文件用记事本打开,然后在首行插入如下代码:

import sys
sys.setrecursionlimit(1000000) #例如这里设置为一百万

然后重新打包即可 pyinstaller -F xxx.spec

Pyinstaller打包出现UnicodeDecodeError: 'utf-8' codec can't decode byte 0xce in position

解决方法:
在命令行中输入 chcp 65001
然后再 pyinstaller -F xxx.py 或者 installer -F xxx.spec

更换镜像源

(1)阿里云:http://mirrors.aliyun.com/pypi/simple/
(2)豆瓣:http://pypi.douban.com/simple/
(3)清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/
(4)中国科学技术大学:http://pypi.mirrors.ustc.edu.cn/simple/
(5)华中科技大学:http://pypi.hustunique.com/

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ name

中文字符编码

UTF-16BE、UTF-16LE、UTF-16 三者之间的区别

三种空格unicode(\u00A0,\u0020,\u3000)表示的区别

python实现读写txt文件的几种方法

解码和编码

python之编码和解码

print('原来你也玩原神!'.encode('utf-8'))
print(b'\xe5\x8e\x9f\xe6\x9d\xa5\xe4\xbd\xa0\xe4\xb9\x9f\xe7\x8e\xa9\xe5\x8e\x9f\xe7\xa5\x9e'.decode('utf-8'))

持续更新,遇到问题再写

参考资料

如何解决 RecursionError: maximum recursion depth exceeded

python maximum recursion depth exceeded解决方式

Pyinstaller打包出现UnicodeDecodeError: 'utf-8' codec can't decode byte 0xce in position

将pip源更换到国内镜像

posted @ 2021-03-09 11:05  a-egoist  阅读(121)  评论(0)    收藏  举报