返回顶部

记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 @   九尾cat  阅读(285)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
点击右上角即可分享
微信分享提示

目录导航