timmy / 檢查 Python 版本是否受 Streamlit 支援
0 喜歡
0 分支
1 檔案
最後活躍 10 months ago
這段程式碼適合用於開發或部署 Streamlit 應用時,確保運行的 Python 版本符合 Streamlit 的支援範圍,避免因版本不符而導致問題。
| 1 | import sys |
| 2 | |
| 3 | class PythonVersionChecker: |
| 4 | def __init__(self, supported_versions): |
| 5 | self.supported_versions = supported_versions |
| 6 | |
| 7 | def get_current_version(self): |
| 8 | """取得當前的 Python 版本。""" |
| 9 | return sys.version_info[:2] |
上一頁
下一頁