jim basquiat jim basquiat - 2 years ago 145
Python Question

Reinstall python with modules

I will format my pc and i would like to somehow collect all the python modules that i have currently and package them (zip or rar etc) / or create an index file of them, so that when i'm done formatting the pc i can reinstall them all in one go, either by using the package/or by using the index created to pip install them all in a batch.

Is there any python module that allows to do that?

Answer Source

Use pip

pip freeze > requirements.txt

This will save the names of all your installed python modules to a file called requirements.txt.

Then when you want to install them again run the following command.

pip install -r requirements.txt

Using a package manager like this is good practice to get into, especially if you use a code repository, so you dont upload all the dependencies to the repo.

If you are not already doing so, its a good idea to use a virtual environment for your python projects. This will create a unique python environment for each of your projects, keeping each project self contained.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download