Activating a virtual environment

Once the environment is created you can activate it by using the activate script in the environment's bin directory. On Linux or macOS you have to source the script:

$ source my_python_3_5_project_env/bin/activate

And on Windows you simply run it:

> my_python_3_5_project_envinactivate

Once you do this your prompt will change to remind you that you're in a virtual environment:

(my_python_3_5_project_env) $

The Python that will execute when you run python is from the virtual environment. In fact, using virtual environments is by far the best way to get a predictable version of Python when you invoke python rather than having to remember to use python for Python 2 and python3 for Python 3.

Once in the virtual environment you can work as normal, secure in the knowledge that package installations are isolated from the system Python and other virtual environments.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset