List installed versions of Python
pyenv versions
List available versions of Python
pyenv install --list
pyenv install --list | grep 3.10
Install specific Python version
pyenv install 3.10.12
Switch Python version local and global
pyenv global 3.10.12
pyenv local 3.10.12
Restart Terminal to apply changes!
Show full path to the current version of python
pyenv which python
Init Poetry with a new folder or try to use Poetry inside the folder.
poetry new projectname
cd projectname
or
mkdir projectname
cd projectname
poetry init
Set the environment
poetry env info
poetry env use <python_version>
poetry install
Double check with
pyenv which python
poetry env info
python --version
Adding azure function as dependency to poetry from requirements.txt
poetry add azure-functions
poetry install
poetry show --tree
Switched Python Interpreter in Codium in .vscode/settings.json (or using CMD+Shift+P and "Select Interpreter")
which python
{
"python.defaultInterpreterPath": "/Users/me/Library/Caches/pypoetry/virtualenvs/marketdata-cli-MiIDVtXc-py3.7/bin/python"
}
or just enter the path by clicking on the Python version in the bottom left corner of VSCode.