Opengist

Explore

  • All gists
  • Topics
  • Users
Give feedback on the new UI Powered by Opengist ⋅ 46ms

user:thomas gists created by user

title:mygist gists with given title

description:sync gists with given description

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

all:systemctl search all fields

Login
c

compatibility-check

Recently created Least recently created Recently updated Least recently updated

timmy / 檢查 Python 版本是否受 Streamlit 支援

Last active 5 hours ago automation compatibility-check python streamlit system-compatibility version-check

這段程式碼適合用於開發或部署 Streamlit 應用時,確保運行的 Python 版本符合 Streamlit 的支援範圍,避免因版本不符而導致問題。

0 0 0 1
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]