返回顶部

记Python编译报错--unexpected indent

记Python编译报错--unexpected indent

报错信息

#python -m py_compile __init__.py
Sorry: IndentationError: unexpected indent (__init__.py, line 89)

原因

在修改python文件,没注意缩写,导致。

解决方法

在提示的上线行找到修改的位置确认缩进等级,再次校验即恢复

重新编译
#python -m py_compile __init__.py
#python -O -m py_compile __init__.py

补充

YUM源安装python3

yum install epel-release
yum install python36

安装反汇编工具uncompyle6

pip3 install uncompyle6

#反汇编
uncompyle6 __init__.pyc > __init__.py

#修改完重新编译一下
 python -m py_compile __init__.py
 python -O -m py_compile __init__.py

配置pip国内源

cat > ~/.pip/pip.conf <<EOF
[global]
index-url=http://mirrors.aliyun.com/pypi/simple
trusted-host=mirrors.aliyun.com
EOF

配置pip代理

适用于局域网情景,需要进行代理

pip --proxy=http://username:passwd@proxy_host install package

 

posted @ 2022-07-07 21:59  九尾cat  阅读(255)  评论(0编辑  收藏  举报