TabError: inconsistent use of tabs and spaces in indentation
这种问题的出现与文本编辑器关于Tab的配置有关,有两种简便的解决方案。
1.文本替换
将Tab替换成4位空格:
sed -e 's;\t; ;' < yourFile.py > yourNedFile.py
or
sed -i 's;\t; ;' yourFile.py
2.脚本处理
使用autopep8对.py文件进行处理:
pip install --upgrade autopep8 --user
export PATH=$PATH:$HOME/.local/bin
autopep8 --in-place --aggressive --aggressive $(find ./ | grep ".py$")