0

This is exactly the same as this question.

The accepted (and only) answer uses distutils which is deprecated.

Simply replacing from distutils.core import setup with from setuptools import setup

and from setuptools.command import install as _install with from distutils.command.install import install as _install

is not enough, because api differs.


I am looking for a solution using setuptools.

Gulzar
  • 23,452
  • 27
  • 113
  • 201
  • https://stackoverflow.com/search?q=%5Bsetuptools%5D+post-install+script – phd Jan 17 '23 at 12:21
  • Note: The solution in the duplicate answer **only works when installing a source distribution** zip or tarball, or installing in editable mode from a source tree. **It will not work when installing from a binary wheel (`.whl`)** – phd Jan 17 '23 at 12:22
  • @phd how to make it also work for `.whl`? – Gulzar Jan 17 '23 at 12:54
  • 1
    No way. `pip` runs code from `setup.py` during build phase but it doesn't run `setup.py` during installation. And wheel format doesn't have provisions for post-install/pre-uninstall scripts. Source distributions (sdist) is the only way. – phd Jan 17 '23 at 13:04

0 Answers0