MCPcopy Create free account
hub / github.com/duorua/narutomobile / get_python_executable_path

Function get_python_executable_path

tools/ci/setup_embed_python.py:70–85  ·  view source on GitHub ↗

获取已安装 Python 环境中的可执行文件路径

(base_dir, os_type)

Source from the content-addressed store, hash-verified

68
69
70def get_python_executable_path(base_dir, os_type):
71 """获取已安装 Python 环境中的可执行文件路径"""
72 if os_type == "Windows":
73 return os.path.join(base_dir, "python.exe")
74 elif os_type == "Darwin": # macOS
75 # python-build-standalone 通常包含 python 和 python3
76 # 我们优先使用 python3 (通常 python 是指向 python3 的符号链接)
77 py3_path = os.path.join(base_dir, "bin", "python3")
78 py_path = os.path.join(base_dir, "bin", "python")
79 if os.path.exists(py3_path):
80 return py3_path
81 elif os.path.exists(py_path): # 作为备选
82 return py_path
83 else:
84 return None # 未找到
85 return None
86
87
88def ensure_pip(python_executable, python_install_dir):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected