10

How do I go about removing all these virtual environments? I don't know where the directories are

Chris
  • 112,704
  • 77
  • 249
  • 231
alois
  • 121
  • 1
  • 4
  • Have you checked that topic ? https://stackoverflow.com/questions/11005457/how-do-i-remove-delete-a-virtualenv – Henry Mont Dec 01 '20 at 19:57
  • Yes. I don't know where these virtualenv's directories are. All I know about them is what they are called. – alois Dec 01 '20 at 20:05
  • Are you on windows or linux ? – Henry Mont Dec 01 '20 at 20:16
  • Neither, I'm on mac os. – alois Dec 01 '20 at 20:22
  • 2
    [Please don't post screenshots of text](https://meta.stackoverflow.com/a/285557/354577). They can't be searched or copied and offer poor usability. Instead, paste the code as text directly into your question. If you select it and click the `{}` button or Ctrl+K the code block will be indented by four spaces, which will cause it to be rendered as code. – Chris Dec 01 '20 at 20:43

2 Answers2

14

Assuming that list came from running pyenv virtualenvs, you should be able to run

pyenv uninstall 3.8.2/envs/greenhouse

to remove the 3.8.2/envs/greenhouse environment.

The environments themselves should be subdirectories of whatever pyenv root returns when you run it. Try doing cd $(pyenv root) and then looking in the versions/ and versions/{version}/envs/ subdirectories.

See the documentation for more details.

Chris
  • 112,704
  • 77
  • 249
  • 231
1

Adding to Chris's answer, you might also need to delete the local .python-version:

$ pyenv uninstall 3.8.12/envs/test_venv 
pyenv-virtualenv: remove /home/user1/.pyenv/versions/3.8.12/envs/test_venv? (y/N) y
$ python -V
pyenv: version 'test_venv' is not installed (set by /home/user1/.python-version)
$ rm .python-version 
rm: remove regular file '.python-version'? y
$ python -V
Python 3.8.12
user455495
  • 115
  • 2
  • 8