user2569002
user2569002

Reputation: 67

Why do we need to install python modules

Lets imagine I created new module. Why do I need to install it via setup file? I mean I can just add my module to PYTHONPATH variable and thats all. Thanks

Upvotes: 2

Views: 567

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1121484

For a simple one-file module, sure, that's enough.

But a setup.py file also lets you create a distribution, associate metadata with the distribution (author, homepage, description, etc.), register your package with the Python Package Index and most of all, lets you define what other packages might be needed to run your code. setup.py is not just for installing your module.

Installing a module with a setup.py based on setuptools also gives you additional functionality, such as support for namespaced packages (multiple distributions sharing a top-level name) and the ability to install multiple versions of a package side by side.

Upvotes: 3

Related Questions