$PATH broken for python environments?
Whenever I try to install something through pip/pip3/python/python3 it will install the package in the folder /opt/homebrew/lib/python3.10/site-packages although there is no python 3.10 installed in /opt/homebrew (or cellar) anymore. I also ran brew doctor and brew cleanup --prune=all, both seemingly fine.
My Setup:
Specs:
Macbook Air M1 Ventura
Visual Studio Code Version: 1.75.0
check for versions:
myusername@MacBook ~ % which pip
/Users/myusername/.pyenv/shims/pip
myusername@MacBook ~ % which pip3
/Users/myusername/.pyenv/shims/pip3
myusername@MacBook ~ % which python
/Users/myusername/.pyenv/shims/python
myusername@MacBook ~ % which python3
/Users/myusername/.pyenv/shims/python3
myusername@MacBook ~ % pyenv versions
system
* 3.11.1 (set by /Users/myusername/.pyenv/version)
3.11.1/envs/venv_mypyenv_playground
venv_mypyenv_playground
myusername@MacBook ~ % which brew
/opt/homebrew/bin/brew
check for PATH:
/Users/<myusername>/.pyenv/shims:/Users/<myusername>/.pyenv/bin:/Users/<myusername>/.pyenv/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/go/bin:/Library/Apple/usr/bin
Side note: For some reason `Users/<myusername>/.pyenv/bin` is in there twice (I am not sure why, because it used to be there once and I didn't change the setup afaik)
hile there's the path /Users/myusername/.pyenv/shims, there is no path: /Users/myusername/.pyenv/bin, but: /Users/myusername/.pyenv/versions/3.11.1/bin
- Maybe that is part of the problem? If so, how can I amend the PATH$ correctly?
Check on Bash and ZSH Setup:
I was wondering if there's something wrong with some bash or zshcr files, which causes python to prioritize homebrew. This is how they look:
My setup:
.bash_profile
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
.bashrc is empty
.zprofile
# set PATH, MANPATH, etc., for Homebrew.
eval "$(/opt/homebrew/bin/brew shellenv)"
.zshrc
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
How can I make sure the path where python will install packages is NOT homebrew/lib/Python3.10 anymore? (Since it doesn't have a corresponding python version, it won't work)
How can I delete the duplicate `Users/<myusername>/.pyenv/bin` in $PATH?
MacBook Air 13″, macOS 13.2