dgorti
dgorti

Reputation: 1240

Delete python environment

Python newbie here. I am on windows. I installed anaconda a while back for my own user account (not for all users on windows). It installed into c:\users...\local..anaconda and all is good. I might have recently updated anaconda and installed VS 2017.

Now I seem to have 4 python environments.

I tried uninstalling from add-remove programs but some how the environments did not go away.

My questions: 1. Where does Visual Studio get the list of environment names? 2. How do I delete these environments? I just want to keep one and delete all the others

Upvotes: 6

Views: 22344

Answers (4)

uinstinct
uinstinct

Reputation: 740

I found my answer to this question here : https://learn.microsoft.com/en-us/visualstudio/python/managing-python-environments-in-visual-studio?view=vs-2019#fix-or-delete-invalid-environments

  • First click this button

Click the button here

  • You will then see this kind of screen

enter image description here

  • Then click the dropdown menu where it shows - packages. Then click the overview tab.
  • Click the delete/remove the enviroment.
  • Your enviroment should now be removed.

Upvotes: 2

bzs
bzs

Reputation: 509

to Question 1:

Visual Studio searches the registry to detect global installed python environments by following PEP 514 as described in Install Python interpreters.

to Question 2:

Open the Visual Studio Installer again and change the current installation by selecting only the python interpreters you need (you will find they in the Components tab).

Upvotes: 0

Struck
Struck

Reputation: 41

I deleted the unwanted registry keys from (what solved the problem for me):

HKEY_CURRENT_USER\Software\Python\PythonCore\

The source mentions also the following keys, but they did not exist in my computer:

HKEY_LOCAL_MACHINE\Software\Python\PythonCore\  
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Python\PythonCore\

Source: https://github.com/Microsoft/PTVS/issues/18

Upvotes: 4

Ofer Sadan
Ofer Sadan

Reputation: 11942

This is the link to read

I'll quote you what I think is relevant for your case, but if it's not, just read it all and find what you need

Any global environment can be added as a project environment by right-clicking Python Environments and selecting Add/Remove Python Environments.... From the displayed list you can select or deselect those environments that are available in your project.+

And...

Once a virtual environment is added to your project, it appears in the Python Environments window, you can activate it like any other environment, and you can manage its packages. Right-clicking it and selecting Remove either removes the reference to the environment, or deletes the environment and all its files on disk (but not the base interpreter).

Upvotes: 0

Related Questions