简体   繁体   中英

Installing data files into %APPDATA% with distutils on Windows 7 X64

My setup routine using distutils that works perfectly fine on Windows XP does not work for Windows 7. Here are the specifics:

My package has a lot of config files which I install into %APPDATA%. On Windows I run setup.py with the bdist_wininst option to create an installer. On Win7 the installer is then executed as Administrator so that the module can be installed into %PROGRAMFILES%\\Python etc. The installation does not report any errors but as you might have guessed the config files will not have been installed into %APPDATA% nor anywhere else (I searched for them).

If I open a cmd as Administrator and install my package with the install option directly (setup.py install), everything works perfectly fine however.

So, what am I missing here? Is this a limitation in the graphical installer or am I doing something wrong?

You may use something like the common solution on *nix. Install the config files to %PROGRAMFILES% , and copy them to %APPDATA% when the program detects a particular user is running the program for the first time (which can be detected by checking that the config files are missing).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM