-1

I tried removing pyenv from my computer, but I'm running into problems running a python program in vscode.

The vscode terminal still reflects "pyenv shell 3.11.4" and "/Users/me/.pyenv/versions/3.11.4/bin/python".

I've already uninstalled pyenv from my system and when I check python version in the terminal, it shows

"/Users/me/.pyenv/shims/python: line 8: /opt/homebrew/opt/pyenv/bin/pyenv: No such file or directory"

How can I clean up pyenv from my system while keeping Python?

Thanks

  • Did you remove the pyenv init invocations from your shell startup configuration? https://github.com/pyenv/pyenv#uninstalling-pyenv – Aeronautix Sep 01 '23 at 17:04
  • If you go into your `~/.zprofile` or `~/.zshrc` or any of your other shell startup configuration files (assuming you're using the default shell `zsh` now used by macOS), make sure that all the lines pertaining to `pyenv` are removed. These lines were written to your startup files upon installation of `pyenv`. – Aeronautix Sep 01 '23 at 17:37
  • Yes, those steps are complete. There aren't any references to pyenv in the .zshrc or .zprofile files. Looking at the vscode terminal, it says: pyenv shell 3.11.4 kb@machine ~ % pyenv shell 3.11.4 zsh: command not found: pyenv So it doesn't recognize pyenv, but for some reason it's trying to execute pyenv command. I'll see if it's something in the vscode preferences. – Kyle Bailey Sep 01 '23 at 19:52
  • (1) If you do `echo "$PATH"`, is there anything `pyenv`-related in the front? (2) If you run `brew install python3`, what does it say at the bottom? (3) Did you restart Visual Studio Code? – Aeronautix Sep 01 '23 at 20:49
  • (1) Yes, /opt/homebrew/opt/pyenv/bin, /Users/me/.pyenv/shims, opt/homebrew/opt/pyenv/bin (2)It says 'Warning: python is already installed to reinstall run brew reinstall python' (3)Yes, restarted vscode, restarted the shell, and restarted my computer – Kyle Bailey Sep 01 '23 at 21:32
  • If you run `echo $0` in your Visual Studio Code terminal, do you get printed "zsh" or "bash"? – Aeronautix Sep 01 '23 at 21:56
  • in vs code it says says zsh – Kyle Bailey Sep 02 '23 at 00:24
  • There shouldn't still be "pyenv" shim directories being exported to PATH, so try doing `arr=( ~/".zlogin" ~/".zshenv" ~/".zprofile" ~/".zshrc" /etc/zshenv /etc/zprofile /etc/zshrc ); for k in "${arr[@]}"; do echo "\n$k"; grep -i pyenv "$k"; done` this tries to find lines in your main zsh startup files to see if `pyenv` appears anywhere in them. If you don't see any lines with "pyenv", there must be something else sourcing the export. If you see lines with "pyenv" though, remove them, and all associated "pyenv" lines around them if there are any. – Aeronautix Sep 02 '23 at 05:37

0 Answers0