pyenv is a simple Python version management.
- Ensure
pythoncommand is OS default.
echo `python --version`; echo `python3 --version`
echo `which python`; echo `which python3`- Install the latest version of
pyenvin home folder.
cd ~
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash- Verify
pyenvinstallation by checking its version and list installablepythonversions.
pyenv --version
pyenv install -l -
Install Python build dependencies following this link.
-
Install multiple versions of
pythonand set one of them at global level.
pyenv install 3.8.13
pyenv install 3.9.13
pyenv install 3.10.5
pyenv global 3.9.13
pyenv versions- Verify
python 3.9.13is set at global level.
echo `python --version`; echo `python3 --version`
echo `which python`; echo `which python3`- Upgrade
pipand list allpipinstalled packages.
pip install -U pip
pip list- Install JupyterLab and multiple commonly used packages.
pip install jupyter jupyterlab black flake8 isort poetry-kernelPoetry is a tool for dependency management and packaging in Python.
- Install the latest version of
poetryin home folder.
cd ~
curl -sSL https://install.python-poetry.org | python3 -- List
poetryconfig and set creation of virtual environment to be within a project folder.
poetry config --list
poetry config virtualenvs.in-project true- Clone a GitHub repository which is developed using different
pythonversion.
git clone git@github.com:{username}/{awesome_project}.git
cd {awesome_project}
pyenv local {python_version}- Install the repository dependencies in
.venvfolder.
poetry install- Install
ipykernelas a development dependency.
poetry install --dev ipykernel- Choose Poetry as a running kernel.
- Set following key-value pairs in
settings.json.
{
"python.defaultInterpreterPath": "/home/waikiat/.pyenv/shims/python",
"python.sortImports.path": "/home/waikiat/.pyenv/shims/isort",
"python.sortImports.args": [
"--profile=black",
],
"python.formatting.blackPath": "/home/waikiat/.pyenv/shims/black",
"python.linting.flake8Path": "/home/waikiat/.pyenv/shims/flake8"
}