pyenv
Links
pyenv
is a simple, yet powerful tool for managing multiple Python versions on Unix-like systems. It allows developers to easily switch between different Python versions, ensuring compatibility across various projects. By isolating Python versions, pyenv
helps prevent conflicts and simplifies the development workflow.
Usage Example
Here’s how to use pyenv
to install and switch between Python versions:
-
Install a specific Python version:
pyenv install 3.8.10
This command downloads and installs Python 3.8.10.
oaicite:2 -
Set the global Python version:
pyenv global 3.8.10
This sets Python 3.8.10 as the default version for all shells.
oaicite:3 -
Set a local Python version for a project:
Navigate to your project directory and run:
pyenv local 3.7.9
This sets Python 3.7.9 as the version for the current directory, overriding the global version.
oaicite:4 -
View installed Python versions:
pyenv versions
This lists all Python versions installed via
pyenv
.oaicite:5