编译

py编译后的pyc可以提高加载速度

编译maya可以直接使用maya脚本编辑器

import py_compile
#使用py_compile

py_compile.compile(r'C:\Users\17893\Downloads\Compressed\2233\123.py')
#编译该路径下的py文件

会在目录下生成同名pyc文件

反编译

你需要一个文件此时热心群友发来一个pyc

能用但是看不了里面内容

在线编译

短代码可以使用在线的反编译工具

点击进入✨在线工具

当代码很长的时候

就只能本地编译了

本地编译

使用开源的uncompyle6反编译pyc

uncompyle6 开源地址:https://github.com/rocky/python-uncompyle6

目前不支持超过包括3.9版本的python

所以先安装一个python3.7

配置环境变量

在用户变量中添加以下(以防万一)我把pip目录之类都加进去了

变量
path C:\Users\17893\AppData\Local\Programs\Python\Python37 (python安装目录)
path C:\Users\17893\AppData\Local\Programs\Python\Python37\python.exe(python程序位置)
path C:\Users\17893\AppData\Local\Programs\Python\Python37\Scripts (python插件目录)
path C:\Users\17893\AppData\Local\Programs\Python\Python37\Scripts\pip.exe (pip程序位置)

🤕重启后生效,切记!!!!

切换成清华镜像源

cmd中运行

python -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

国内网络不切换可能会之后pip下载插件和更新报错

更新下pip🎁

cmd中运行

python -m pip install --upgrade pip
安装uncompyle6

cmd中运行

python -m pip install uncompyle6
uncompyle6用法

cmd中运行

cd C:\Users\17893\Downloads\Compressed\CDK
#打开pyc文件所在目录

python -m uncompyle6 -o test.py test.pyc
#如果提示没有uncompyle6则无需加python -m
uncompyle6 -o test.py test.pyc
#反编译text.pyc 输出到test.py

#和鬼一样不知道为啥有时候必须加python -m
#有时候又不加