Skip to content

Instantly share code, notes, and snippets.

@chewwt
Created June 7, 2022 08:00
Show Gist options
  • Save chewwt/c65a05959cf7dbb727ff3b76d8695be8 to your computer and use it in GitHub Desktop.
Save chewwt/c65a05959cf7dbb727ff3b76d8695be8 to your computer and use it in GitHub Desktop.
pyenv offline setup

Pyenv Offline Setup

  1. Download and transfer pyenv
  2. Extract pyenv-x.x.x.tar.gz into ~/.pyenv
  3. Add into ~/.zshrc and source
    export PATH=/home/user/.pyenv/bin:$PATH
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"
  4. Download and transfer desired python-3.x.x
  5. Place Python-3.x.x.tar.zx file in ~/.pyenv/cache (Don't untar)
  6. Run pyenv install 3.x.x
@tomercagan
Copy link

tomercagan commented Nov 28, 2024

Thanks for that!

A few notes to others that come here

  • For the first command (export) - you should change it to your current user or can use $USER environment variable
export PATH=/home/$USER/.pyenv/bin:$PATH
  • In the last command, pyenv virtualenv-init is a plugin and for latest version today - 2.4.19 - is not installed by default. To use it you will need to install it (not sure how to do it, specifically offline)
  • If you don't want to use pyenv by default, don't change your ~/.zshrc. For other shells, change the relevant file (e.g. ~/.bashrc)
  • ~/.pyenv/cache does not exist by default - create it with mkdir ~/.pyenv/cache.
  • Make sure you download the Python-3.x.x.tar.zx and not other versions that may exist (I initially downloaded .tgz 🤦‍♂️)

@MSK61
Copy link

MSK61 commented May 29, 2025

@tomercagan pyevn-virtualenv is available here. You can grab a tarball and extract it as explained in its README file(simply by extracting the archive under $(pyenv root)/plugins/.
Alternatively it should also be possible to get rid of the pyenv virtualenv-init step entirely, as it isn't mentioned in the official pyenv shell integration steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment