fix: fix finding python path

This commit is contained in:
Amin Yahyaabadi 2021-09-16 15:33:13 -05:00
parent 8a1490eabe
commit 53b53fef98
1 changed files with 6 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import which from "which"
import { addPath, info } from "@actions/core" import { addPath, info } from "@actions/core"
import { setupPython } from "../../python/python" import { setupPython } from "../../python/python"
import { isBinUptoDate } from "./version" import { isBinUptoDate } from "./version"
import { join } from "path"
let pip: string | undefined let pip: string | undefined
@ -34,7 +35,11 @@ export async function setupPipPack(name: string, version?: string) {
} else if (process.platform === "darwin") { } else if (process.platform === "darwin") {
binDir = "/usr/local/bin/" binDir = "/usr/local/bin/"
} else { } else {
binDir = (await getExecOutput("python -c 'import sys\nprint(sys.base_exec_prefix)'")).stdout try {
binDir = join((await getExecOutput('python3 -c "import sys;print(sys.base_exec_prefix);"')).stdout, "Scripts")
} catch {
binDir = join((await getExecOutput('python -c "import sys;print(sys.base_exec_prefix);"')).stdout, "Scripts")
}
} }
info(`${binDir} to PATH`) info(`${binDir} to PATH`)
addPath(binDir) addPath(binDir)