11

I'm installing Python 3 with Chocolatey, which installs into C:\ProgramData\chocolatey\lib\python3:

> choco install python3

Is there any way I can get Python3 to install into C:\Python35 instead?

I´m aware of this question which is related to Python 2 ... but here a different package is used thus the answer there does not help in this case.

Community
  • 1
  • 1
Wlad
  • 2,866
  • 3
  • 28
  • 42
  • This is pretty much a duplicate of http://stackoverflow.com/q/34581991/18475 – ferventcoder Aug 09 '16 at 16:25
  • @ferventcoder: As I said I am aware of it ;-) But the answer there does not work for python3 package - I have tried it. – Wlad Aug 09 '16 at 21:52
  • The general idea is the same, you pass arguments through Chocolatey. Yes, the exact command arguments are different, as one would expect for different installers. It might be surprising to some that Python2 and Python3 have differences in the installers though. :) – ferventcoder Aug 09 '16 at 23:55
  • UPDATE: `> choco install python3` now installs to C:\Python35 by default. – Wlad Nov 16 '16 at 12:15

2 Answers2

12

There is a possibility to override --installargs like this:

> choco install python3 -y --override --installarguments "'/quiet  InstallAllUsers=1 TargetDir=c:\Python35'"

You might see some (access denied) errors (guess Python 3.5.1 Package is broken) but overall it seems to work.

I recommend to create your own Package as there is a newer Python version 3.5.2 which is not in the public package feed on chocolatey.org yet

Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
Wlad
  • 2,866
  • 3
  • 28
  • 42
  • Or, you could help with getting the Python package that is on the Community Feed working. The package source files are on GitHub, and we (I), would welcome any help that you could offer. – Gary Ewan Park Aug 11 '16 at 06:48
  • @GaryEwanPark I just followed this [tutorial](https://www.topbug.net/blog/2012/07/02/a-simple-tutorial-create-and-publish-chocolatey-packages/), I changed version `3.5.1` to `3.5.2`. And in `chocolateyInstall.ps1` I changed five lines: 4.`$url = 'https://www.python.org/ftp/python/3.5.2/python-3.5.2.exe'`, 5. `$url64 = 'https://www.python.org/ftp/python/3.5.2/python-3.5.2-amd64.exe'`, 6. `$version = '3.5.2'`, 9. `$partialInstallArgs = '/quiet /passiv InstallAllUsers=1 PrependPath=1 TargetDir='`, 14. `$installArgs = $($partialInstallArgs + '"' + $installPath + '"')` – Wlad Aug 11 '16 at 11:31
  • Sorry but the formating in comment is terrible ... can´t get it better :( – Wlad Aug 11 '16 at 11:35
2

With Python 3.8.2 at least, all you can do is change the registry yourself before installing. For instance type this:

REG ADD HKLM\SOFTWARE\Python\PythonCore\3.8\InstallPath /ve /d C:/Python38 /f
Michel de Ruiter
  • 7,131
  • 5
  • 49
  • 74