Reputation: 1240
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
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
Upvotes: 2
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
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
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