Hey, check out my Modern Python Projects course. It's an extended version of this workshop!
pyenv
, pipx
, and virtual environmentsLet’s put what we just learned into action.
Here are some exercises where you will install and test the tools that we just talked about.
pyenv
and pipx
. You can also install one of the virtual environment tools, but using either the built-in venv
or pyenv-virtualenv
is perfectly fineInstall a newer version of Python using pyenv
. If you are already using the latest version, try to install an older one.
$ pyenv local
and $ pyenv shell
commands to see how they work.Create a new virtual environment.
$ pip install cowsay
(it’s a silly package that prints some ASCII image together with whatever text you ask it to say)$ cowsay hello world
$ pip freeze
$ deactivate
$ cowsay hello again
Install a package with pipx
. For example: $ pipx install glances
(glances is a pretty useful tool to see what’s going on on your computer)
$ pipx list
$ glances
$ pipx uninstall glances
) and install it with pip INSIDE the virtual environment.