SharpChmod 是一个 Linux 文件权限计算器,用 Python Tkinter 编写。它可以帮助你快速计算 chmod 权限值,并生成可复制的 chmod 命令。
- 勾选所有者、用户组、其他人的读 / 写 / 执行权限
- 输入八进制权限,例如
755、644、4755 - 输入符号权限,例如
rwxr-xr-x、rw-r--r-- - 支持
setuid、setgid、sticky特殊权限位 - 自动生成
chmod命令 - 一键复制命令
- 常用权限预设
- 说明区域支持滚动,窗口变小时也能查看完整内容
如果当前电脑已经安装 Python 3,推荐双击:
start_chmod_calculator.pyw
如果 .pyw 没反应,可以双击备用启动器:
start_chmod_calculator.vbs
备用启动器会依次尝试使用 pyw、py、pythonw、python 启动程序。
在项目目录中执行:
py -3 chmod_calculator.py或:
python chmod_calculator.py如果目标电脑没有安装 Python,不能直接运行 .py / .pyw 文件。
这种情况需要使用打包后的 exe:
dist\SharpChmod.exe
只要 exe 已经打包完成,目标电脑不需要安装 Python,双击 SharpChmod.exe 即可运行。
如果修改了源码,需要重新生成 exe,可以安装并使用 PyInstaller:
py -3 -m pip install pyinstaller
py -3 -m PyInstaller --onefile --windowed --name SharpChmod chmod_calculator.py打包完成后,程序会生成在:
dist\SharpChmod.exe
如果项目里已经有 SharpChmod.spec,也可以使用:
py -3 -m PyInstaller SharpChmod.spec运行单元测试:
py -3 -m unittest test_chmod_calculator.py语法检查:
py -3 -m py_compile chmod_calculator.py start_chmod_calculator.pyw test_chmod_calculator.pychmod_calculator.py:主程序start_chmod_calculator.pyw:无控制台窗口启动器start_chmod_calculator.vbs:Windows 备用双击启动器test_chmod_calculator.py:权限计算逻辑测试SharpChmod.spec:PyInstaller 打包配置dist\SharpChmod.exe:打包后的可执行文件