Difference between revisions of "Creating a virtual environment in Visual Studio"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "If you have created a new Python based project, you now need to create a virtual environment. You lack the permissions on college machines to install any python modules, on yo...")
 
Line 9: Line 9:
  
 
[[File:New ve.png]]
 
[[File:New ve.png]]
 +
 +
You will need to give the environment a name, this is called 'MyEnv':
 +
 +
[[File:Myenv.png]]
 +
 +
You should also select the version of python, select the highest available.
 +
 +
=Using Virtual Environment=
 +
 +
In college, you can't use the Visual Studio option to install a package into your virtual environment. This seems to be a permission issue, and you also can't run a command prompt to actually enter the code yourself.

Revision as of 13:15, 30 April 2019

If you have created a new Python based project, you now need to create a virtual environment. You lack the permissions on college machines to install any python modules, on your own machines virtual environments are a good idea for controlling which python modules are installed for which python projects.

New Virtual Environment

In the solution explorer for your new project:

PythonEnvironments.png

You will be able to right click on Python Environments and select 'Add Virtual Environment':

New ve.png

You will need to give the environment a name, this is called 'MyEnv':

Myenv.png

You should also select the version of python, select the highest available.

Using Virtual Environment

In college, you can't use the Visual Studio option to install a package into your virtual environment. This seems to be a permission issue, and you also can't run a command prompt to actually enter the code yourself.