Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
378 views
in Technique[技术] by (71.8m points)

python - How do you do a proper silent installation Miniconda3 with Windows PowerShell on Windows 10?

I try to install Miniconda via Powershell, and it works fine as long as the destination directory does not contain spaces, but unfortunately it does. Now, there are many, many posts on this topics and I tried to try out all the solutions, but in vain. Therefore, I have to still post ask what I do wrong here:

curl.exe --output Miniconda3-py39_4.9.2-Windows-x86_64.exe --url https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Windows-x86_64.exe
$minidir="$Env:ProgramFilesMiniconda3"
Start-Process Miniconda3-py39_4.9.2-Windows-x86_64.exe -Wait -ArgumentList @('/S', '/InstallationType=JustMe', '/RegisterPython=1', '/D="$minidir"')

The problem lies in that $Env:ProgramFiles variable contains a space:

PS C:> echo $Env:ProgramFiles
C:Program Files

What I did not do is use a short-cut name for the directory without a space, because I am not sure if this is really good practice. I tried different variants of "`" and ", but unfortunately I was unsuccessful. The installation guide I followed can be found here: https://docs.anaconda.com/anaconda/install/silent-mode/ and I adapted the manual for Windows Command Prompt to Windows PowerShell. I would be extremely grateful, if someone could help me with the spacing problem, although it has been asked a lot before, because I just do not seem to see the error.

EDIT: Thanks for @notjustme to insist. I need to precreate the working directory when using PowerShell, which was I am pretty sure not necessary with Windows Command Prompt.

curl.exe --output Miniconda3-py39_4.9.2-Windows-x86_64.exe --url https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Windows-x86_64.exe
$minidir="$Env:ProgramFilesMiniconda3"
mkdir $minidir
Start-Process Miniconda3-py39_4.9.2-Windows-x86_64.exe -Wait -ArgumentList @('/S', '/InstallationType=JustMe', '/RegisterPython=1', '/D="$minidir"')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...