1

I created a project in virutalenv with all libraries installed. So, when I move the virtualenv directory to new machine/environment, How do I get it work? And in new machine what needs to be installed apart from standard python?

I have all referece of directory and import refering to virtual env only.

I know this is very basic question. But, I was not able to find answer.

PKM15
  • 109
  • 1
  • 8

1 Answers1

1

You shouldn't move your virtualenv since it is essentially linked to your system python and the binary won't necessarily work on other machines.

However, you can export a list of installed packages and install them in another virtualenv through a requirements.txt file.

# Generate a requirements file
pip freeze > requirements.txt

On the new machine, first create a new virtualenv and then install the packages by using the requirements.txt file as a reference.

# Install the packages
pip install -r requirements.txt
JRodDynamite
  • 12,325
  • 5
  • 43
  • 63