python相关技巧

一、安装配置文件

pip install -r newrequirements.txt -i https://mirrors.aliyun.com/pypi/simple/

二、其他技巧

python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple

三、直接下载whl文件

网址

四、如果cmd命令行中安装时出现如下错误,比如

pip3 install -U weditor

出现:"UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xaa in position……"的报错信息的时候,将命令行中显示模式修改一下,再运行上述命令就正常了:

chcp 65001

但仍然出错,最后解决办法是降低版本安装,教程地址Wedtior使用教程

五、如果是运行文件时出现:Python中出现"UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xaa in position……"的报错信息的时候,在命令中加上 encoding=‘utf-8’ 即可解决问题。

五、二维数组(列表|向量)

maxbj  = 6
# lists = [[]]*maxbj  # 这样追加元素后所有列表是一样的,可能是大家索引一样
lists = [[] for i in range(maxbj)]  # 这样追加元素后每个列表是独立的可能是各自索引不同的原因