2

I want to duplicate my Python development station. I need to be able to install, with pip, the same libraries that were installed on the original station. Is there a simple way to that instead of going into the pip list and installing all the libraries one by one ?

The Main purpose is to be able to duplicate the same environment that I have in one station to another station with minimum overhead. I won't like to be required to track the existence or absence of the libraries by myself

5
  • 1
    You should use virtual environments. Commented Jan 3, 2018 at 15:01
  • I second @hop . You might also want to take a look at docker containers. Commented Jan 3, 2018 at 15:05
  • 2
    If under linux then $ pip freeze > requirements.txt and then $ pip install -r requirements.txt Commented Jan 3, 2018 at 15:05
  • this is now the officially recommended tool: github.com/pypa/pipenv Commented Jan 3, 2018 at 15:06
  • If you are using pycharm ==> change the interpreter and then select from conda package install which libs you want to install. Commented Jan 3, 2018 at 15:26

1 Answer 1

2

1.(On virtual enviroment) Save libraries and versions

pip freeze > requirements.txt

2. Install on new enviroment

pip install -r <path of requirements.txt>
Sign up to request clarification or add additional context in comments.

5 Comments

What if I don't have a virtual environment ? Will "pip freeze" function the same ?
@MosheS. if you don't have a virtual environment, all the python libraries on your pc will saved on requirements.txt
You mean all the Python libraries that were installed by pip. Right ?
All python libraries, not necessarily just those installed with pip
Just to help others, I found out that the freeze created the requirements only for the list of libraries that were installed with pip.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.