This tool is used to install `pyenv` and friends.

Overview

pyenv installer

This tool installs pyenv and friends. It is inspired by rbenv-installer.

Prerequisites

In general, compiling your own Python interpreter requires the installation of the appropriate libraries and packages. The installation wiki provides a list of these for common operating systems.

Installation / Update / Uninstallation

Once prerequisites have been installed correctly:

Install:

$ curl https://pyenv.run | bash

pyenv.run redirects to the install script in this repository and the invocation above is equivalent to:

$ curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

Restart your shell so the path changes take effect:

$ exec $SHELL

You can now begin using pyenv.

If you need, export USE_GIT_URI to use git:// instead of https:// for git clone.

Update:

$ pyenv update

Uninstall:

pyenv is installed within $PYENV_ROOT (default: ~/.pyenv). To uninstall, just remove it:

$ rm -fr ~/.pyenv

then remove these three lines from .bashrc:

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

and finally, restart your shell:

$ exec $SHELL

Using pyenv-installer on Travis CI

Travis itself uses pyenv and therefore PYENV_ROOT is set already. To make it work anyway the installation for pyenv-installer needs to look like this:

[...]
- unset PYENV_ROOT
- curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
- export PATH="$HOME/.pyenv/bin:$PATH"
- pyenv install 3.5.2

Development and testing

The project on github contains a setup for vagrant to test the installer inside a vagrant managed virtual image.

If you don't know vagrant yet: just install the latest package, open a shell in this project directory and say

$ vagrant up
$ vagrant ssh

Now you are inside the vagrant container and your prompt should like something like vagrant@vagrant-ubuntu-trusty-64:~$

The project (this repository) is mapped into the vagrant image at /vagrant

$ cd /vagrant
$ python setup.py install
$ echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"' >> ~/.bashrc
$ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
$ source ~/.bashrc

Pyenv should be installed and responding now.

Version History

20190111

  • Remove experimental PyPi support and replace with a dummy package.

20150113

  • Initial release on PyPi.

20130601

  • Initial public release.

License

MIT - see License file.

Comments
  • ".pyenv is not on master branch"

    A fresh install (with pyenv-installer of course) followed by attempting to execute pyenv update gives me this set of errors:

    image

    Guessing, but maybe related to this change? https://github.com/pyenv/pyenv-update/pull/4

    opened by joshsleeper 13
  • Automatically update path

    Automatically update path

    Does the installer purposely not update the path?

    $ curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
    WARNING: seems you still have not added 'pyenv' to the load path.
    
    # Load pyenv automatically by adding
    # the following to ~/.bash_profile:
    
    export PATH="$HOME/.pyenv/bin:$PATH"
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"
    

    CentOS 6.5

    Many Thanks

    opened by ghost 12
  • get-pip.py is no longer compatible with python2.6

    get-pip.py is no longer compatible with python2.6

    I have installed openssl, readline from homebrew, then use pyenv install python 2.6.7 cause error. I try to debug this error. I found pyenv may not be linked openssl.

    yongjie.zhao@:workspace$ pyenv install 2.6.9
    python-build: use openssl from homebrew
    python-build: use readline from homebrew
    Downloading Python-2.6.9.tgz...
    -> https://www.python.org/ftp/python/2.6.9/Python-2.6.9.tgz
    Installing Python-2.6.9...
    patching file setup.py
    Hunk #1 succeeded at 354 (offset 9 lines).
    patching file ./configure
    patching file ./Modules/readline.c
    Hunk #1 succeeded at 199 (offset -7 lines).
    Hunk #2 succeeded at 698 (offset -51 lines).
    Hunk #3 succeeded at 808 (offset -51 lines).
    Hunk #4 succeeded at 848 with fuzz 2 (offset -70 lines).
    patching file ./setup.py
    Hunk #1 succeeded at 1698 (offset 23 lines).
    patching file ./Lib/ssl.py
    patching file ./Modules/_ssl.c
    python-build: use readline from homebrew
    Installing pip from https://bootstrap.pypa.io/get-pip.py...
    error: failed to install pip via get-pip.py
    
    BUILD FAILED (OS X 10.13.3 using python-build 20160602)
    
    Inspect or clean up the working tree at /var/folders/jh/43k6mlm116q4mzskbszmm2hh60hf8t/T/python-build.20180319143249.14627
    Results logged to /var/folders/jh/43k6mlm116q4mzskbszmm2hh60hf8t/T/python-build.20180319143249.14627.log
    
    Last 10 log lines:
    		/Users/yongjie.zhao/.pyenv/versions/2.6.9/share/man/man1/python.1
    Traceback (most recent call last):
      File "get-pip.py", line 22373, in <module>
        main()
      File "get-pip.py", line 194, in main
        bootstrap(tmpdir=tmpdir)
      File "get-pip.py", line 82, in bootstrap
        import pip
      File "/var/folders/jh/43k6mlm116q4mzskbszmm2hh60hf8t/T/tmpnHxF2K/pip.zip/pip/__init__.py", line 34, in <module>
    AttributeError: 'module' object has no attribute 'OPENSSL_VERSION_NUMBER'
    
    enhancement 
    opened by zhaoyongjie 10
  • Fix wrong impression that pyenv should be installed via pip

    Fix wrong impression that pyenv should be installed via pip

    pip install pyenv is pretty broken - why is it here anyway?

    The current state is that usage of pip install pyenv is discouraged and does not work in (if I should hazard a guess) all but the most standard cases (and only with Python2). pip uninstall pyenv does not work at all, which is simply embarassing. I dropped the ball there as just too much else was going on in my life. No excuse. Just an explanation.

    As pyenv is a collection of shell scripts and has a perfectly nice way of installing and updating already, the question begs: why is it on pypi anyway? Two reasons:

    1. At the time there was an abandoned project (actually never really started) with the same name on pypi and I wanted to clear up the naming confusion by having the actual pyenv project on pypi to raise awareness that such a great tool exists. (thanks again @yyuu - I could not imagine doing without it anymore). So I wrote a hacky proof of concept for pip installation (not really having a clue about what I was doing at that time) and asked the owner of the defunct project and the friendly maintainers of pypi to let the real pyenv in and they were nice enough to do that (original issue if you are interested).
    2. pyenv is not a project written in Python, but it is a project for the Python ecosystem. pypi is very much the epicenter of the Python ecosystem - so in my mind pyenv belongs there ... but it would be nice if it then would actually work :)

    So how can I fix the mess I made? I have several ideas:

    Remove pip install functionality

    ... by making a special release on pypi that clearly documents the "correct" way of installing pyenv (which is not via pip but via Github).

    This could also be a first step as a temporary solution that is better to have something utterly broken on pypi.

    Remove functionality from pyenv-installer

    ... but create a new project called e.g. pyenv-pip-installer that will be hosted as pyenv on pypi and provide proper pip install functionality with a release cylce that is detached from pyenvs release cycle

    Fix it right here

    ... by just making it work (by using setuptools instead of distutils to start with). This is still favorite solution.

    There are a few things to consider though:

    1. pyenv is actually meant to work in user space without needing to have adminstrative rights - that's part of the beauty of it. A normal pip install call tries to install to the system Python though - although this is being discussed if this might change in the future. To make it work for pyenv properly atm the user would have to be at least aware that he would have to invoke pip with the --user flag. I did not look into that to deeply yet though.
    2. Different behaviours on different platforms (could we even make it work on Windows? Windows 10 has a linux subsystem now and otherwise bash can be installed in several ways on Windows (Cygwin, whatever).
    3. Synchronizing releases on Github and pypi. This screams for automation, thorugh Travis or something like that - haven't thought about it yet, but should be pretty easy to have a hook that makes a releas on pypy whenever @yyuu releases on Github.

    Related issues

    • https://github.com/yyuu/pyenv-installer/issues/43
    • https://github.com/yyuu/pyenv-installer/issues/25
    • https://github.com/yyuu/pyenv/issues/764
    • https://github.com/yyuu/pyenv/issues/755
    • https://github.com/yyuu/pyenv/issues/387

    Anything else?I would be happy about feedback/help :)

    enhancement 
    opened by obestwalter 10
  • error message in first install

    error message in first install

    I was installing pyenv in a new laptop, and do a new install with pyenv-installer.

    all was good, but I have an error message that didn't appear in previous installs.

    ~  pyenv update
    Updating /home/yonsy/.pyenv...
    pyenv-update: /home/yonsy/.pyenv is not on master branch.
    Updating /home/yonsy/.pyenv/plugins/pyenv-doctor...
    From https://github.com/yyuu/pyenv-doctor
    * branch            master     -> FETCH_HEAD
    Already up-to-date.
    Updating /home/yonsy/.pyenv/plugins/pyenv-installer...
    From https://github.com/yyuu/pyenv-installer
    * branch            master     -> FETCH_HEAD
    Already up-to-date.
    Updating /home/yonsy/.pyenv/plugins/pyenv-update...
    From https://github.com/yyuu/pyenv-update
    * branch            master     -> FETCH_HEAD
    Already up-to-date.
    Updating /home/yonsy/.pyenv/plugins/pyenv-virtualenv...
    From https://github.com/yyuu/pyenv-virtualenv
    * branch            master     -> FETCH_HEAD
    Already up-to-date.
    Updating /home/yonsy/.pyenv/plugins/pyenv-which-ext...
    From https://github.com/yyuu/pyenv-which-ext
    * branch            master     -> FETCH_HEAD
    Already up-to-date.
    ✘  ~ 
    

    you can view the error message pyenv-update: /home/yonsy/.pyenv is not on master branch.

    debugging this, i find that in verify_repo_branch function for base ~/.pyenv directory (the pyenv repo, not plugins), git name-rev --name-only HEAD returns tags/v1.0.5, not master and this causes the problem.

    opened by ysolis 10
  • https://pyenv.run script still references https://github.com/yyuu/pyenv-installer

    https://pyenv.run script still references https://github.com/yyuu/pyenv-installer

    The command

    $ curl https://pyenv.run
    

    Returns

    #!/bin/bash
    #
    # Usage: curl https://pyenv.run | bash
    #
    # For more info, visit: https://github.com/yyuu/pyenv-installer
    #
    set -e
    curl -s -S -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash -s -- "$@"
    

    I know this still works because of GitHub renaming. But would it not be best to point to

    https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer ?

    bug 
    opened by rossmacarthur 9
  • Install to /usr/local when using sudo.

    Install to /usr/local when using sudo.

    Latest version of python comes with Debian is 3.5. I need a newer version. I have daemon written in Python starting at boot time, which requires Python not be installed to any user folder.

    Currently when using installer with sudo, Python is installed under /root. It'd be nice to recognize sudo privilege and install it to /usr/local instead.

    Thanks!

    question 
    opened by tigerinus 9
  • curl pyenv.run | bash

    curl pyenv.run | bash

    I add bought this domain to simplify the installer line, because I can never remember it :) You can now install with:

    curl pyenv.run | bash
    

    This redirects to https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer using curl so you don't need -L on curl above.

    I don't mind supporting this or if you want, I can turn the domain over to whomever you like.

    enhancement 
    opened by robnagler 9
  • Instead of requiring `git` be installed, use curl/wget to grab the latest release or master.zip?

    Instead of requiring `git` be installed, use curl/wget to grab the latest release or master.zip?

    If they can curl https://pyenv.run | bash then we know they can grab files via curl, and on almost all systems (minus Git Bash on Windows), even if they don't have the zip package or the unzip command they likely have python or python3 which includes a ZipFile.extract() function in the standard library. For safety you could try ZipFile.testzip() to see if the zip was corrupted during the download.

    opened by espoelstra 8
  • bash: pyenv: command not found and how to solve it

    bash: pyenv: command not found and how to solve it

    In CentOS 7, I ran

    $ curl https://pyenv.run | bash

    and then

    $ exec $SHELL

    However when trying to see if I had pyenv installed by updating it

    pyenv update

    I was getting the error

    bash: pyenv: command not found


    Solution (found here)

    It turns out the pyenv path wasn't exported to .bashrc. It can be done by executing the following commands in terminal:

    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
    echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
    echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
    

    Then restart the shell

    exec "$SHELL"

    opened by goncaloperes 7
  • How to add this into a Dockerfile

    How to add this into a Dockerfile

    Hi guys,

    I want to add pyenv into a 3rdparty project using Docker. Do you mind to gimme a hand?

    • Could you please confirm that the corresponding header files such as Python.h can be found for a particular python version?

    • It's unclear how to do the PATH updates such that the container route to

    Thanks in advance!

    P.D. I know that it's not the principle solution, but I'm not familiar with the 3rdparty project and only know the basics of Docker. I do use Unix, but not very familiar with ubuntu (distro used in the Dockerfile of the project 😓)

    opened by escorciav 7
  • Update shell config file during installation (bash & zsh)

    Update shell config file during installation (bash & zsh)

    Fix: #112

    For users using the installation script, it is natural that the environment variables will be automatically modified

    Outline

    • Modify user's profile based on current shell & system(bash & zsh, currently)

    Discussion:

    • Should we add an environment variable, so that users can choose not to modify their shell config profiles?

    References

    • https://github.com/nvm-sh/nvm#install--update-script
    • https://github.com/ofek/userpath
    • https://github.com/ofek/userpath/issues/3
    opened by ianchen-tw 5
  • Add documentation for default plugins installed

    Add documentation for default plugins installed

    A few plugins are installed by default:

    https://github.com/pyenv/pyenv-installer/blob/49fba599e872bc761858ea6f700271fb6dcb5a97/bin/pyenv-installer#L46-L51

    Please,

    • Add to README, a list of the default plugin installed by the installer
    • Add an option to disable installing these plugin, or don't install any plugins by default.
    opened by ketozhang 0
  • How to install a particular release/commit?

    How to install a particular release/commit?

    With command :curl https://pyenv.run | bash , it will install from master branch latest code everytime. Is there any option to use a particular commit/release for the installation?

    yesterday it worked without any problem in our pipeline. But today, our pipeline failed because of the python-build tool is expecting this package as prerequisite: (yum package -y patch)

    So to make it consistent with the repo changes, we want to use a particular commit or relase.

    Please suggest.

    opened by uday-projectn 2
  • Failed to git clone https://github.com/pyenv/pyenv-installer.git

    Failed to git clone https://github.com/pyenv/pyenv-installer.git

    Hi, I'm running the install script on my remote Debian 9.9 (stretch) server

    when I run curl https://pyenv.run | bash, pyenv-doctor gets installed, but pyenv-installer fails:

    user@remote_server:~$ curl https://pyenv.run | bash
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   270  100   270    0     0    688      0 --:--:-- --:--:-- --:--:--   687
    Cloning into '/home/ddobrinskiy/.pyenv'...
    remote: Enumerating objects: 916, done.
    remote: Counting objects: 100% (916/916), done.
    remote: Compressing objects: 100% (458/458), done.
    remote: Total 916 (delta 521), reused 590 (delta 351), pack-reused 0
    Receiving objects: 100% (916/916), 474.92 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (521/521), done.
    Checking out files: 100% (898/898), done.
    Cloning into '/home/ddobrinskiy/.pyenv/plugins/pyenv-doctor'...
    remote: Enumerating objects: 11, done.
    remote: Counting objects: 100% (11/11), done.
    remote: Compressing objects: 100% (9/9), done.
    remote: Total 11 (delta 1), reused 5 (delta 0), pack-reused 0
    Unpacking objects: 100% (11/11), done.
    Cloning into '/home/ddobrinskiy/.pyenv/plugins/pyenv-installer'...
    remote: Enumerating objects: 16, done.
    remote: Counting objects: 100% (16/16), done.
    remote: Compressing objects: 100% (13/13), done.
    remote: Total 16 (delta 1), reused 8 (delta 0), pack-reused 0
    Unpacking objects: 100% (16/16), done.
    fatal: missing blob object '03cc13c3e36ac727eef4d3ffd3c8ed608735f1f3'
    fatal: remote did not send all necessary objects
    Failed to git clone https://github.com/pyenv/pyenv-installer.git
    

    I suspect this is related by a missing object in git, not sure how to debug though

    fatal: missing blob object '03cc13c3e36ac727eef4d3ffd3c8ed608735f1f3'

    opened by ddobrinskiy-bc 1
  • Still see system /usr/bin/python after activation

    Still see system /usr/bin/python after activation

    I am learning pyenv.

    After reading existing open/closed issue. I finally got pyenv installed on RockLinux 8.5. But when I try to activate 3.9.8 for log4j project, the which python still return /usr/bin/python.

    • Please advise where I did wrong. from following log
    [me@rocky8t01 ~]$ which python
    /usr/bin/python
    [me@rocky8t01 ~]$ pyenv --version
    pyenv 2.2.3
    [me@rocky8t01 ~]$ pyenv activate log4j
    pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
    (log4j) [me@rocky8t01 ~]$ which python
    /usr/bin/python
    (log4j) [me@rocky8t01 ~]$ pyenv versions
      system
      3.9.8
      3.9.8/envs/log4j
    * log4j (set by PYENV_VERSION environment variable)
    (log4j) [me@rocky8t01 ~]$ /usr/bin/python -V
    Python 3.6.8
    (log4j) [me@rocky8t01 ~]$ echo $PATH
    /home/me/.pyenv/bin:/home/me/.cargo/bin:/home/me/.local/bin:/home/me/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
    (log4j) [me@rocky8t01 ~]$
    
    
    • Not sure why activate didn't insert "/home/me/.pyenv/versions/3.9.8/bin/" path into $PATH variable ?
    (log4j) [me@rocky8t01 ~]$ export PATH=/home/me/.pyenv/versions/3.9.8/bin:$PATH
    (log4j) [me@rocky8t01 ~]$ which python
    ~/.pyenv/versions/3.9.8/bin/python
    (log4j) [me@rocky8t01 ~]$
    
    
    opened by tjyang 3
Owner
pyenv
pyenv
pyenv
Fish shell tool for managing Python virtual environments

VirtualFish VirtualFish is a Python virtual environment manager for the Fish shell. You can get started by reading the documentation. (It’s quite shor

Justin Mayer 968 Dec 24, 2022
Define requirements inside your python code and scriptenv makes them ready to import.

scriptenv Define requirements inside your python code and scriptenv makes them ready to import. Getting Started Install scriptenv $ pip install script

Stefan Hoelzl 6 Nov 4, 2022
A fast and easy python virtual environment creator for linux with some pre-installed libraries.

python-venv-creator A fast and easy python virtual environment created for linux with some optional pre-installed libraries. Dependencies: The followi

null 2 Apr 19, 2022
to-requirements.txt allows to automatically add and delete modules to requirements.txt installing them using pip.

to-requirements.txt | Automatically update requirements.txt to-requirements.txt allows to automatically add and delete modules to requirements.txt ins

Ilya 16 Dec 29, 2022
🖍️This is a feature-complete clone of the awesome Chalk (JavaScript) library.

Terminal string styling done right This is a feature-complete clone of the awesome Chalk (JavaScript) library. All credits go to Sindre Sorhus. Highli

Fabian Keller 132 Dec 27, 2022
Spam your friends and famly and when you do your famly will disown you and you will have no friends.

SpamBot9000 Spam your friends and family and when you do your family will disown you and you will have no friends. Terms of Use Disclaimer: Please onl

DJ15 0 Jun 9, 2022
a pyenv plugin to manage virtualenv (a.k.a. python-virtualenv)

pyenv-virtualenv pyenv-virtualenv is a pyenv plugin that provides features to manage virtualenvs and conda environments for Python on UNIX-like system

pyenv 5.3k Jan 8, 2023
Your own movie streaming service. Easy to install, easy to use. Download, manage and watch your favorite movies conveniently from your browser or phone. Install it on your server, access it anywhere and enjoy.

Vigilio Your own movie streaming service. Easy to install, easy to use. Download, manage and watch your favorite movies conveniently from your browser

Tugcan Olgun 141 Jan 6, 2023
Fonts used to be an install-and-forget thing, but many of are now updated regularly.

Your font manager. Fonts used to be an install-and-forget thing, but many of are now updated regularly. fontman helps you keep track of the fonts you

Nico Schlömer 20 Feb 7, 2022
Securely and anonymously share files, host websites, and chat with friends using the Tor network

OnionShare OnionShare is an open source tool that lets you securely and anonymously share files, host websites, and chat with friends using the Tor ne

Micah Lee 5.4k Jan 2, 2023
Secret santa is a fun and easy way to get together with your friends and/or family with a gift for them.

Secret Santa What is Secret Santa? Secret santa is a fun and easy way to get together with your friends and/or family with a gift for them. The idea i

null 2 Dec 6, 2021
Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends.

Quiz Application Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends. When they would a

Atharva Parkhe 1 Feb 23, 2022
Let your friends know when you are online and offline xD

Twitter Last Seen Activity Let your friends know when you are online and offline Laser-light eyes when online Last seen is mentioned in user bio Also

Kush Choudhary 12 Aug 16, 2021
General purpose GPU compute framework for cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends). Blazing fast, mobile-enabled, asynchronous and optimized for advanced GPU data processing usecases.

Vulkan Kompute The general purpose GPU compute framework for cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends). Blazing fast, mobile-enabl

The Institute for Ethical Machine Learning 1k Dec 26, 2022
Lets you remove all friends, leave GCs, and leave servers, in an instant!

anonymity Lets you remove all friends, leave GCs, and leave servers, in an instant! You can also do each of them by themselves. First, you need to get

null 1 Dec 7, 2021
A python mailserver meant for friends who value privacy and a hard to use interface....

python-mail A python mailserver meant for friends who value privacy and a hard to use interface.... Basic info This mailserver was just a random proje

Hashm 2 Jan 19, 2022
Covid-19-Trends - A project that me and my friends created as the CSC110 Final Project at UofT

Covid-19-Trends Introduction The COVID-19 pandemic has caused severe financial s

null 1 Jan 7, 2022
A bot which is a ghost and you can make friends with it

This is a bot which is a ghost and you can make friends with it. It will haunt your friends. Explore and test the bot in replit !

Siwan SR 0 Oct 6, 2022
Wordle-bot: A Discord bot to track you and your friends' Wordle scores.

wordle-bot A Discord bot to track you and your friends' Wordle scores, so you can see who's the best! To submit a score to wordle-bot, just paste the

Spencer Murray 8 Feb 16, 2022
⌚️Internet Time reference and (eventually) converter site, for planning things with your internet friends who aren't (yet) obsessed with Internet Time 😉

Internet-Ti.me Internet Time reference and (eventually) converter site, for planning things with your internet friends who aren't (yet) obsessed with

Jessica Stokes 17 Nov 2, 2022