update InstallPyDep for better macOS support

This commit is contained in:
josc146 2023-06-07 20:38:19 +08:00
parent 260f51955a
commit 6294327273

View File

@ -52,9 +52,12 @@ func (a *App) InstallPyDep(python string, cnMirror bool) (string, error) {
if err != nil {
return "", err
}
if runtime.GOOS == "windows" {
ChangeFileLine("./py310/python310._pth", 3, "Lib\\site-packages")
}
if runtime.GOOS == "windows" {
if cnMirror {
_, err = Cmd(python, "./backend-python/get-pip.py", "-i", "https://pypi.tuna.tsinghua.edu.cn/simple")
} else {
@ -63,6 +66,8 @@ func (a *App) InstallPyDep(python string, cnMirror bool) (string, error) {
if err != nil {
return "", err
}
}
if runtime.GOOS == "windows" {
_, err = Cmd(python, "-m", "pip", "install", "torch==1.13.1", "torchvision==0.14.1", "torchaudio==0.13.1", "--index-url", "https://download.pytorch.org/whl/cu117")
} else {
@ -71,9 +76,18 @@ func (a *App) InstallPyDep(python string, cnMirror bool) (string, error) {
if err != nil {
return "", err
}
if runtime.GOOS == "windows" {
if cnMirror {
return Cmd(python, "-m", "pip", "install", "-r", "./backend-python/requirements.txt", "-i", "https://pypi.tuna.tsinghua.edu.cn/simple")
} else {
return Cmd(python, "-m", "pip", "install", "-r", "./backend-python/requirements_versions.txt")
}
} else {
if cnMirror {
return Cmd(python, "-m", "pip", "install", "-r", "./backend-python/requirements_without_cyac.txt", "-i", "https://pypi.tuna.tsinghua.edu.cn/simple")
} else {
return Cmd(python, "-m", "pip", "install", "-r", "./backend-python/requirements_without_cyac.txt")
}
}
}