Override default installation directory for Python bdist Windows installer

落花浮王杯 提交于 2019-12-03 13:01:56

You should write setup.cfg where you can specify installation options(see python setup.py install --help output) and then run python setup.py bdist. When creating binary distro python will do the dumb installation under the "build" subdir with this options and create the installer from this dumb installation. For example, if you want to create bdist which installs libraries to /some/lib/path and scripts to /some/bin/path create the following setup.cfg:

[install] 
prefix=/
install_lib=/some/lib/path
install_scripts=/some/bin/path

And then run python setup.py bdist

From running python setup.py --help install:

Options for 'install' command:
  --prefix                             installation prefix
  --exec-prefix                        (Unix only) prefix for platform-
                                       specific files
  --home                               (Unix only) home directory to install
                                       under
  --user                               install in user site-package
                                       '/home/jterrace/.local/lib/python2.7/si
                                       te-packages'
  --install-base                       base installation directory (instead of
                                       --prefix or --home)
  --install-platbase                   base installation directory for
                                       platform-specific files (instead of --
                                       exec-prefix or --home)
  --root                               install everything relative to this
                                       alternate root directory

I do beleive that MaxSin's answer was somewhat correct. But to use his answer for the command: "python setup.py bdist_wininst" you would have to do it like this:

[bdist_wininst] 
prefix=/
install_lib=/some/lib/path
install_scripts=/some/bin/path

Seeing as the syntax here is:

[command]
option=value
...

edit:

It looks like this doesnt work :( not sure of a possible other solution.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!