How can I check if the correct python version is used after activating a virtual environment? I tried which python3 and which python but both outputs indicate the system python version and not the local pyenv version. Is it still using my local version or is there something wrong with my installs?
Here is the command line output.
Documents/DataStuff/pdf_tools via v3.9.5
❯ python --version
zsh: command not found: python
Documents/DataStuff/pdf_tools via v3.9.5
❯ python3 --version
Python 3.9.5
Documents/DataStuff/pdf_tools via v3.9.5
❯ pyenv global
3.8.5
Documents/DataStuff/pdf_tools via v3.9.5
❯ pyenv local
3.7.5
Documents/DataStuff/pdf_tools via v3.9.5
❯ python3 -m venv .venv
Documents/DataStuff/pdf_tools via v3.9.5 took 31s
❯ source .venv/bin/activate
(.venv)
Documents/DataStuff/pdf_tools via v3.9.5 (.venv)
❯ which python
/mnt/c/Users/Saša/Documents/DataStuff/pdf_tools/.venv/bin/python
(.venv)
Documents/DataStuff/pdf_tools via v3.9.5 (.venv)
❯ python --version
Python 3.9.5
(.venv)
Documents/DataStuff/pdf_tools via v3.9.5 (.venv)
❯ python3 --version
Python 3.9.5
(.venv)
Here is some system information:
System: windows-linux-subsystem2
Package manager: Homebrew 3.1.5
Python version: 3.9.5
Pyenv version: 1.2.27
Installation steps:
- Install python and pyenv via homebrew.
brew install python-tk@3.9
brew install pyenv
- Install python versions 3.7.5 and 3.8.5 via pyenv.
pyenv install 3.7.5
pyenv install 3.8.5
- Set pyenv global to 3.8.5 (3.9.5 is not supported yet) and local to 3.7.5
pyenv global 3.8.5
pyenv local 3.7.5
- Create a virtual environment
python3 -m venv .venv
- Activate the virtual environment
source .venv/bin/activate