Install pyenv¶
To install pyenv on Fedora 40, you'll need to follow these steps:
- Install the required dependencies:
sudo dnf install -y make gcc zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel xz-devel
- Clone the pyenv repository:
- Add pyenv to your PATH and initialize it. Add these lines to your ~/.bashrc or ~/.zshrc file:
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
- Reload your shell configuration:
- Verify the installation:
This should output the version of pyenv you've installed.
Now you can use pyenv to install and manage different Python versions. For example, to install Python 3.9.5:
And to set it as your global Python version:
Would you like me to explain any part of this process in more detail?