Missions: Using pip and virtualenv
Installing packages and creating virtualenvs
At the terminal, you can create a new virtual environment by typing mkvirtualenv, followed by a name of your choice for the new virtualenv.
Now, open up the terminal, type the following command and press Enter:mkvirtualenv TestEnv
The above command will create a new virtual environment called TestEnv. The name of the virtual environment can be anything you like. The output of the above command should look something like this:
New python executable in TestEnv/bin/python Installing setuptools, pip...done.
After running the mkvirtualenv command above, the name of the virtualenv you created, surrounded by parenthesis, (TestEnv) in this case, will appear before your terminal prompt, which will look somewhat similar to:
(TestEnv)C:\Users\username> on Windows or,
(TestEnv)user@hostname:~ $ on Linux/Mac OS X.
This means that we are inside our virtualenv TestEnv, and we can now install packages in it, which brings us neatly to our next topic.
You can install a new package by typing pip install, followed by the name of the package you want to install.
For this part of the mission, we are going to install a package called Requests, which is an HTTP library written in Python.
Now, to install Requests, at the terminal, type the following command and press Enter:pip install requests
After Requests has installed successfully, type pip freeze at the terminal and press Enter. The pip freeze command lists all Python packages installed in our environment.
To complete this part of the mission, select the output of the pip freeze command with your mouse and use your terminal program's copy-paste functionality to copy it to the clipboard. Paste it into the form below. Then, submit!