-
Notifications
You must be signed in to change notification settings - Fork 0
Pyenv Usage: Command Line
Document Release Date: 1/2/2024
Note: In the I.T. world, applications evolve rapidly. Please report any inaccuracy to papabearcodespython@gmail.com
Pyenv is a python version/flavor installer, that allows you install multiple versions and flavors of python on the same machine.
NOTE: !!!The version/flavor of python available to you will depend highly on the OS you are running.!!!
For example:
- It allows you to have python version 3.9.0 and 3.10.6 installed at the same time. However, only on can be active at the time.
- It allows for plain
python
installations as well asanaconda
There are two different type of python version/flavor selections:
- Locally (Creates a .python-version file in your current directory when activating the python version/flavor)
- Globally (Active for the entire machine)
NOTE: !!!The version/flavor of python available to you will depend highly on the OS you are running.!!!
To list the version available for your OS type:
pyenv install --list
You can pick a version the install. The version you selected is what you will use to replace <version>
with in the installation and activation instructions.
To install a particalar python version
use the command:
pyenv install <version>
After installing a particular version/flavor of python you can activate it locally
or globally
If there is no .python-version
file in your current directory then type:
pyenv local <version>
This will create a file .python-version
in your current directory.
If there is a .python-version
file in your current directory then type:
pyenv local
This will activate the version of python/flavor designated in the .python-version
file.
Type the command:
pyenv global <version>
This is now the version available when you have not designated a local version. Pretty much, if you don't have a .python-version
file and have designated a global version, then the command python
will be the global version.
To figure out what version of python you are using type the command:
python --version
- If you get an error that
python
command is not found. You do not have a current active python version. - If a version returns than it either comes from a global and local install.