import streamlit as st import subprocess def get_cuda_version(): result = subprocess.run(['nvcc', '--version'], capture_output=True, text=True) output = result.stderr.strip() cuda_version = None for line in output.split("\n"): if "release" in line.lower(): cuda_version = line.split(",")[2].strip() break return cuda_version st.title("CUDA 版本") cuda_version = get_cuda_version() if cuda_version: st.write(f"当前CUDA版本为: {cuda_version}") else: st.write("未找到CUDA版本信息")