DataOrc
DataOrc

Reputation: 839

How can I install all my python 2 packages for python 3?

I installed Anaconda with Python 2.7 and then later installed the Python 3.6 kernel. I have lots of Python 2 packages and I don't want to have to manually install all of the packages for Python 3. Has anyone written, or does anyone know how to write, a bash script that will go through all my Python 2 packages and just run pip3 install [PACKAGE NAME]?

Upvotes: 1

Views: 166

Answers (1)

DMe
DMe

Reputation: 7826

In your Python 2 pip, run pip freeze > requirements.txt. This will write all your installed packages to a text file.

Then, using your Python 3 pip (perhaps pip3), run pip install -r /path/to/requirements.txt. This will install all of the packages as listed in the requirements.txt file.

Upvotes: 2

Related Questions