- 在py文件前加上一段:
#!/usr/bin/env python
- 打開終端輸入chmod 777 yourfile.py
- 打開macOS上的腳本編輯器
tell application "Terminal"
set newTab to do script "cd /Users/..........."
do script "./yourfile.py" in front window
end tell
然後運行進行測試,可以的話就保存到桌面
#!/usr/bin/env python
tell application "Terminal"
set newTab to do script "cd /Users/..........."
do script "./yourfile.py" in front window
end tell
然後運行進行測試,可以的話就保存到桌面
class MetaCls(type): def __new__(cls, *args, **kwargs): print("in MetaCls") # return super(Meta