Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Re-creating a Development Environment

00:00 Now I want to re-create exactly this development environment in another folder. You can think of this as the steps your friend would do or what you would do if you want to continue working on your project on another computer. First, create a new folder. The one before was creatively named project, so let’s name this one same_project. You type mkdir same_project, and then hit Enter.

00:33 You change into the new folder with cd same_project. Inside the folder, create a new virtual environment, python3

00:46 -m venv venv, and activate it with source venv/bin/activate.

00:55 So far, there are no packages installed in this virtual environment, but let’s check that with pip list. python3 -m pip list. All right, so that means when I type python3 -m rich, I get an error because this package is not installed yet.

01:17 Okay, before we continue, let’s clear the screen again.

01:22 Next, I want to copy the requirements file from the former project folder into the current one. For this, you can use the cp command. You type cp ../project/requirements.txt and then a space and then ./requirements.txt With a command like this, you have to think from the perspective of your current directory you are in. The .. is an alias for the parent directory, and there you find the project folder of the requirements file.

02:01 That’s the item you want to copy. The second part of the command is the target path, which is ./requirements.txt. The . stands for the current directory, and requirements.txt is the filename. When you press Enter, you copy the requirements file from the folder project/ into your current directory.

02:25 Let’s check it out if it worked by typing ls. Okay, cool, you see your venv folder and the requirements file. But having the requirements file in your project directory and an activated virtual environment is not enough.

02:41 You also need to install the requirements. For this, you run python3 -m pip install—that’s a command you already know—and then a space -r space requirements.txt And this installs exactly the packages with exactly the versions you froze in the other project folder because they are all saved in the requirements.txt file.

03:09 Now both development environments are exactly the same. Let’s verify this by running python3 -m pip list. Cool. Okay, so that means rich is present, and python3 -m rich works. Wonderful!

03:30 I don’t know about you, but I could look at this terminal forever.

03:34 Anyway, once you’re ready, let’s meet in the next lesson. There, I’ll show you how to find third-party packages on your own.

Avatar image for Ignacio Romero

Ignacio Romero on June 18, 2024


I can not use the comands cp, clear, pwd…I do not know if it is because of the language of the windows version.

I found that pwd could be cd, cd could be copy, but the way to work is different. Is that right or I am missing something in my computer?

In the path I have the ones I need:

C:\Windows C:\Windows\System32 C:\Windows\System32\Wbem


Avatar image for Martin Breuss

Martin Breuss RP Team on June 19, 2024

Hi @Ignacio Romero, yes, the Windows terminal uses different commands, although if you work with PowerShell, a lot of the Unix commands should work too.

Take a look at the separate course on using the terminal in Windows. Hope that helps!

Become a Member to join the conversation.