add torch cnMirror

This commit is contained in:
josc146 2024-05-10 16:37:31 +08:00
parent 2ddcd17d23
commit 2a55c8256d

View File

@ -227,8 +227,12 @@ func (a *App) InstallPyDep(python string, cnMirror bool) (string, error) {
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
ChangeFileLine("./py310/python310._pth", 3, "Lib\\site-packages") ChangeFileLine("./py310/python310._pth", 3, "Lib\\site-packages")
torchIndexUrl := "https://download.pytorch.org/whl/cu117"
if cnMirror {
torchIndexUrl = "https://mirrors.aliyun.com/pytorch-wheels/cu117"
}
installScript := python + " ./backend-python/get-pip.py -i https://mirrors.aliyun.com/pypi/simple --no-warn-script-location\n" + installScript := python + " ./backend-python/get-pip.py -i https://mirrors.aliyun.com/pypi/simple --no-warn-script-location\n" +
python + " -m pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 --index-url https://download.pytorch.org/whl/cu117 --no-warn-script-location\n" + python + " -m pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 --index-url " + torchIndexUrl + " --no-warn-script-location\n" +
python + " -m pip install -r ./backend-python/requirements.txt -i https://mirrors.aliyun.com/pypi/simple --no-warn-script-location\n" + python + " -m pip install -r ./backend-python/requirements.txt -i https://mirrors.aliyun.com/pypi/simple --no-warn-script-location\n" +
"exit" "exit"
if !cnMirror { if !cnMirror {