qpace
Version:
📊 The Quant SDK for Python and Javascript. Written in Rust.
35 lines (34 loc) • 900 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: Object.getOwnPropertyDescriptor(all, name).get
});
}
_export(exports, {
get getPythonVersion () {
return getPythonVersion;
},
get locatePython () {
return locatePython;
}
});
const _exec = require("./exec");
const _os = require("./os");
const locatePython = async ()=>{
let path = await (0, _os.which)("python3");
path ??= await (0, _os.which)("python");
return path;
};
const getPythonVersion = async (pythonPath)=>{
try {
const res = await (0, _exec.exec)({
command: `${pythonPath ?? "python3"} --version`
});
if (res.exitCode === 0) return res.stdout.trim();
} catch (err) {}
return;
};