0

I need to mirror all my Python settings and modules on Computer A vs Computer B.

I could list all packages/modules in computer A using pip list and then install them on computer B one by one - but there are literally ~ 100s of packages.

Is there a better/quicker way to achieve this?

In addition:

1) When overwriting previous installations, for example, do I have to use pip install --force-reinstall "pandas==0.23.0"?

2) Is there a way to exclude selected packages (some personal, redundant modules)?

Both machines are Windows and run the same Python version.

EStark
  • 161
  • 4
  • 18
  • just zip the installation and overwrite onto the old one to make an exact copy. There is also the "requirements" option, where you can install a list of packages, not one by one – Jean-François Fabre Sep 28 '19 at 10:38

1 Answers1

5

On the old system

pip freeze >frozen.txt

Then copy the output file to the destination system and

pip install -r frozen.txt

You can't have both detailed control and quick convenience; if you want more control, manually prune the file before installing the packages.

A common convention is to manually add the packages which your code directly depends on to a file called requirements.txt; then just run pip install -r requirements.txt on the destination system.

Rather than have an endlessly raging battle between packages with different and possibly conflicting requirements, explore using a virtual environment for each.

tripleee
  • 175,061
  • 34
  • 275
  • 318