Skip to content

Commit 3ea30db

Browse files
authored
Merge pull request #9525 from rachana-satao/RAS-09feb22-VS-Py-1889169-6
update 1
2 parents 3f1b38c + abc47bc commit 3ea30db

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

docs/python/tutorial-working-with-python-in-visual-studio-step-05-installing-packages.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
22
title: Python in Visual Studio tutorial step 5, install packages
33
titleSuffix: ""
4-
description: Step 5 is a core walk-through to demonstrate Python capabilities in Visual Studio and Visual Studio's features to manage packages in a Python environment.
5-
ms.date: 12/11/2021
6-
ms.custom: devdivchpfy22
4+
description: Step 5 of a core walkthrough of Python capabilities in Visual Studio. Demonstrates Visual Studio features on how to manage and install packages in a Python environment.
5+
ms.date: 02/28/2022
76
ms.topic: tutorial
87
author: rjmolyneaux
98
ms.author: rmolyneaux
@@ -13,6 +12,7 @@ ms.technology: vs-python
1312
ms.workload:
1413
- python
1514
- data-science
15+
ms.custom: devdivchpfy22
1616
---
1717

1818
# Step 5: Install packages in your Python environment
@@ -23,9 +23,7 @@ The Python developer community has produced thousands of useful packages that yo
2323

2424
## View environments
2525

26-
1. Select the **View** > **Other Windows** > **Python Environments** menu command. The **Python Environments** window opens as a peer to **Solution Explorer**.
27-
28-
The Python environments window shows the different environments that are available to you. The list shows both environments that you installed using the Visual Studio installer, and environments that you installed separately. These environments include global, virtual, and conda environments. The environment in bold is the default environment that's used for new projects. For more information about working with environments, see [How to create and manage Python environments in Visual Studio environments](managing-python-environments-in-visual-studio.md).
26+
1. Select the **View** > **Other Windows** > **Python Environments** menu command. The **Python Environments** window opens as a peer to **Solution Explorer** and shows the different environments available to you. The list shows both environments that you installed using the Visual Studio installer and environments you installed separately. That includes global, virtual, and conda environments. The environment in bold is the default environment that's used for new projects. For more information about working with environments, see [How to create and manage Python environments in Visual Studio environments](managing-python-environments-in-visual-studio.md).
2927

3028
:::moniker range=">=vs-2022"
3129
![Python Environments window-2022](media/environments/environments-default-view-2022.png)
@@ -74,31 +72,27 @@ The Python developer community has produced thousands of useful packages that yo
7472
![Unresolved package import](media/packages-unresolved-import.png)
7573
:::moniker-end
7674

77-
1. The **Overview** tab in the Python Environments window provides quick access to an **Interactive** window for that environment and the installation folder of the environment and interpreters. The **Packages** tab is available below the Overview tab.
75+
1. When you look at the editor window, notice that when you hover over the `numpy` and `matplotlib` import statements that they aren't resolved. The reason is the packages haven't been installed to the default global environment.
7876

7977
For example, select **Open interactive window** and an **Interactive window** for that specific environment appears in Visual Studio.
8078

8179
1. The **Packages** tab in the Python Environments window lists all packages that are currently installed in the environment.
8280

8381
## Install packages using the Python Environments window
8482

85-
See the steps below to install Python packages in the **Python Environment** window.
83+
1. From the Python Environments window, select the default environment for new Python projects and choose the **Packages** tab. You'll then see a list of packages that are currently installed in the environment.
8684

8785
:::moniker range=">=vs-2022"
8886
[Install packages in an environment](media/environments/install-python-packages-2022.gif)
8987
:::moniker-end
9088

91-
1. From the **Python Environments** window, select the default environment for new Python projects.
89+
1. Install `matplotlib` by entering its name into the search field and then selecting the **Run command: pip install matplotlib** option. Running the command will install `matplotlib`, and any packages it depends on (in this case that includes `numpy`).
9290

9391
1. Choose the **Packages** tab.
9492

95-
:::moniker range="vs-2022"
96-
![Packages installed in an environment-2022](media/environments/environments-installed-packages-2022.png)
97-
:::moniker-end
93+
1. Consent to elevation if prompted to do so.
9894

99-
:::moniker range="<=vs-2019"
100-
![Packages installed in an environment-2019](media/environments/environments-installed-packages-2019.png)
101-
:::moniker-end
95+
1. After the package is installed, it appears in the **Python Environments** window. The **X** to the right of the package uninstalls it.
10296

10397
1. Enter `matplotlib` into the search field to install `matplotlib`.
10498

@@ -131,7 +125,7 @@ See the steps below to install Python packages in the **Python Environment** win
131125

132126
## Run the program
133127

134-
After installing `matplotlib` [matplotlib](https://matplotlib.org/), run the program with (**F5**) or without the debugger (**Ctrl**+**F5**) to see the output:
128+
Now that [matplotlib](https://matplotlib.org/) is installed, run the program with (**F5**) or without the debugger (**Ctrl**+**F5**) to see the output:
135129

136130
![Output of matplotlib example](media/environments/environments-add-matplotlib3.png)
137131

0 commit comments

Comments
 (0)