how to msi install Python to non-default target dir?

Zachary Ware zachary.ware+pylist at gmail.com
Wed Jul 16 09:47:31 EDT 2014


On Wed, Jul 16, 2014 at 8:29 AM, Albert-Jan Roskam
<fomcl at yahoo.com.dmarc.invalid> wrote:
> hi,
>
> I am trying to create a .bat file where (among other things) Python will have to be silently installed.
> It needs to be installed to the non-default location "c:\program files\python27". Any idea how this can be done?
> I keep getting the 'Help' menu, indicating that something went wrong. I've been fighting with this for like an hour now! :-(
>
> I followed this structure [1]: msiexec /i (yourFile).msi TARGETDIR=C:\YourBin\YourApp
>
> The following does NOT work (I added the cd/md commands later, idem for the /qb)
>
> y:\>set PYTHONDIR="c:\program files\python27"
> y:\>cd /d "c:\program files"
> y:\>md python27
> y:\>cd /d %temp%
> y:\>msiexec /i python-2.7.3 TARGETDIR="%PYTHONDIR%" /qb

I'm assuming this is retyped and you missed the '.msi' in retyping?
If not, that may be your issue.  Also, 'set' doesn't require quotes
around a value with spaces, and you're also quoting %PYTHONDIR% when
you use it in the msiexec command, so you're actually double-quoting
the dir name (which could also be the issue).  And, not necessarily an
issue that would prevent installing, but you may want to make sure
you're in the correctly-bitted Program Files directory if you're on
64-bit Windows (%PROGRAMFILES% for 64-bit, %PROGRAMFILES(x86)% for
32-bit; %PROGRAMFILES(x86)% will not be defined on 32-bit Windows or
in a 32-bit process on 64-bit Windows).

-- 
Zach



More information about the Python-list mailing list