{"id":13393866,"url":"https://github.com/pyenv/pyenv","last_synced_at":"2026-04-08T17:00:50.428Z","repository":{"id":4486331,"uuid":"5625464","full_name":"pyenv/pyenv","owner":"pyenv","description":"Simple Python version management","archived":false,"fork":false,"pushed_at":"2026-03-24T06:05:34.000Z","size":6409,"stargazers_count":44474,"open_issues_count":56,"forks_count":3244,"subscribers_count":385,"default_branch":"master","last_synced_at":"2026-03-24T11:50:03.336Z","etag":null,"topics":["python","shell"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyenv.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["pyenv"],"patreon":null,"open_collective":"pyenv","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2012-08-31T06:57:52.000Z","updated_at":"2026-03-24T11:36:11.000Z","dependencies_parsed_at":"2023-10-17T03:02:01.043Z","dependency_job_id":"f59ae1c8-3289-4863-b491-24c4cc0a2ffc","html_url":"https://github.com/pyenv/pyenv","commit_stats":{"total_commits":2643,"total_committers":476,"mean_commits":5.552521008403361,"dds":0.866061293984109,"last_synced_commit":"0f8b2b2b848ea080b0e01a707910c272ec4ce736"},"previous_names":["yyuu/pyenv"],"tags_count":230,"template":false,"template_full_name":null,"purl":"pkg:github/pyenv/pyenv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyenv%2Fpyenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyenv%2Fpyenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyenv%2Fpyenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyenv%2Fpyenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyenv","download_url":"https://codeload.github.com/pyenv/pyenv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyenv%2Fpyenv/sbom","scorecard":{"id":113763,"data":{"date":"2025-08-04","repo":{"name":"github.com/pyenv/pyenv","commit":"685f2815265c9c0fbdb92544de6c476fb8a33f3d"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":5.2,"checks":[{"name":"Code-Review","score":4,"reason":"Found 13/30 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 22 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: topLevel 'contents' permission set to 'read': .github/workflows/macos_build.yml:5","Warn: no topLevel permission defined: .github/workflows/modified_scripts_build.yml:1","Info: found token with 'none' permissions: .github/workflows/no-response.yml:1","Info: topLevel 'contents' permission set to 'read': .github/workflows/pyenv_tests.yml:5","Info: topLevel 'contents' permission set to 'read': .github/workflows/ubuntu_build.yml:5","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/macos_build.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/pyenv/pyenv/macos_build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/modified_scripts_build.yml:102: update your workflow using https://app.stepsecurity.io/secureworkflow/pyenv/pyenv/modified_scripts_build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/modified_scripts_build.yml:163: update your workflow using https://app.stepsecurity.io/secureworkflow/pyenv/pyenv/modified_scripts_build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/modified_scripts_build.yml:221: update your workflow using https://app.stepsecurity.io/secureworkflow/pyenv/pyenv/modified_scripts_build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/modified_scripts_build.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/pyenv/pyenv/modified_scripts_build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/modified_scripts_build.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/pyenv/pyenv/modified_scripts_build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/no-response.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/pyenv/pyenv/no-response.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pyenv_tests.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/pyenv/pyenv/pyenv_tests.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ubuntu_build.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/pyenv/pyenv/ubuntu_build.yml/master?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating ubuntu:18.04 to ubuntu:18.04@sha256:152dc042452c496007f07ca9127571cb9c29697f42acbfad72324b2bb2e43c98","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T20:34:55.039Z","repository_id":4486331,"created_at":"2025-08-15T20:34:55.039Z","updated_at":"2025-08-15T20:34:55.039Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31564915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","shell"],"created_at":"2024-07-30T17:01:01.608Z","updated_at":"2026-04-08T17:00:50.418Z","avatar_url":"https://github.com/pyenv.png","language":"Shell","readme":"# Simple Python Version Management: pyenv\n\n[![Join the chat at https://gitter.im/yyuu/pyenv](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/yyuu/pyenv?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\npyenv lets you easily switch between multiple versions of Python. It's\nsimple, unobtrusive, and follows the UNIX tradition of single-purpose\ntools that do one thing well.\n\nThis project was forked from [rbenv](https://github.com/rbenv/rbenv) and\n[ruby-build](https://github.com/rbenv/ruby-build), and modified for Python.\n\n### What pyenv _does..._\n\n* Lets you **change the global Python version** on a per-user basis.\n* Provides support for **per-project Python versions**.\n* Allows you to **override the Python version** with an environment\n  variable.\n* Searches for commands from **multiple versions of Python at a time**.\n  This may be helpful to test across Python versions with [tox](https://pypi.python.org/pypi/tox).\n\n\n### In contrast with pythonbrew and pythonz, pyenv _does not..._\n\n* **Depend on Python itself.** pyenv was made from pure shell scripts.\n    There is no bootstrap problem of Python.\n* **Need to be loaded into your shell.** Instead, pyenv's shim\n    approach works by adding a directory to your `PATH`.\n* **Manage virtualenv.** Of course, you can create [virtualenv](https://pypi.python.org/pypi/virtualenv)\n    yourself, or [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv)\n    to automate the process.\n\n\n----\n\n\n## Table of Contents\n\n* **[Installation](#installation)**\n  * [Getting Pyenv](#a-getting-pyenv)\n    * [Linux/UNIX](#linuxunix)\n      * [Automatic Installer](#1-automatic-installer-recommended)\n      * [Basic GitHub Checkout](#2-basic-github-checkout)\n    * [MacOS](#macos)\n      * [Homebrew in macOS](#homebrew-in-macos)\n    * [Windows](#windows)\n  * [Set up your shell environment for Pyenv](#b-set-up-your-shell-environment-for-pyenv)\n  * [Restart your shell](#c-restart-your-shell)\n  * [Install Python build dependencies](#d-install-python-build-dependencies)\n  * [Upgrade Notes](#e-upgrade-notes)\n* **[Usage](#usage)**\n  * [Install additional Python versions](#install-additional-python-versions)\n    * [Prefix auto-resolution to the latest version](#prefix-auto-resolution-to-the-latest-version)\n    * [Python versions with extended support](#python-versions-with-extended-support)\n  * [Switch between Python versions](#switch-between-python-versions)\n    * [Making multiple versions available](#making-multiple-versions-available)\n  * [Uninstall Python versions](#uninstall-python-versions)\n  * [Other operations](#other-operations)\n* [Upgrading](#upgrading)\n  * [Upgrading with Homebrew](#upgrading-with-homebrew)\n  * [Upgrading with Installer or Git checkout](#upgrading-with-installer-or-git-checkout)\n* [Uninstalling pyenv](#uninstalling-pyenv)\n* [Pyenv plugins](#pyenv-plugins)\n* **[How It Works](#how-it-works)**\n  * [Understanding PATH](#understanding-path)\n  * [Understanding Shims](#understanding-shims)\n  * [Understanding Python version selection](#understanding-python-version-selection)\n  * [Locating Pyenv-provided Python Installations](#locating-pyenv-provided-python-installations)\n* [Advanced Configuration](#advanced-configuration)\n  * [Using Pyenv without shims](#using-pyenv-without-shims)\n  * [Running nested shells from Python-based programs](#running-nested-shells-from-python-based-programs)\n  * [Environment variables](#environment-variables)\n* **[Development](#development)**\n  * [Contributing](#contributing)\n  * [Version History](#version-history)\n  * [License](#license)\n\n\n----\n\n## Installation\n\n### A. Getting Pyenv\n----\n#### Linux/Unix\n\u003cdetails\u003e\n\nThe Homebrew option from the [MacOS section below](#macos) would also work if you have Homebrew installed.\n\n##### 1. Automatic installer (Recommended)\n\n```bash\ncurl -fsSL https://pyenv.run | bash\n```\n\nFor more details visit our other project:\nhttps://github.com/pyenv/pyenv-installer\n\n\n##### 2. Basic GitHub Checkout\n\nThis will get you going with the latest version of Pyenv and make it\neasy to fork and contribute any changes back upstream.\n\n* **Check out Pyenv where you want it installed.**\n   A good place to choose is `$HOME/.pyenv` (but you can install it somewhere else):\n    ```\n    git clone https://github.com/pyenv/pyenv.git ~/.pyenv\n    ```\n*  Optionally, try to compile a dynamic Bash extension to speed up Pyenv. Don't\n   worry if it fails; Pyenv will still work normally:\n    ```\n    cd ~/.pyenv \u0026\u0026 src/configure \u0026\u0026 make -C src\n    ```\n\u003c/details\u003e\n\n#### MacOS\n\n\u003cdetails\u003e\n\nThe options from the [Linux section above](#linuxunix) also work but Homebrew is recommended for basic usage.\n\n##### [Homebrew](https://brew.sh) in macOS\n\n   1. Update homebrew and install pyenv:\n      ```sh\n      brew update\n      brew install pyenv\n      ```\n      If you want to install (and update to) the latest development head of Pyenv\n      rather than the latest release, instead run:\n      ```sh\n      brew install pyenv --head\n      ```\n   3. Then follow the rest of the post-installation steps, starting with\n      [Set up your shell environment for Pyenv](#b-set-up-your-shell-environment-for-pyenv).\n\n   4. OPTIONAL. To fix `brew doctor`'s warning _\"\"config\" scripts exist outside your system or Homebrew directories\"_\n\n      If you're going to build Homebrew formulae from source that link against Python\n      like Tkinter or NumPy\n      _(This is only generally the case if you are a developer of such a formula,\n      or if you have an EOL version of MacOS for which prebuilt bottles are no longer provided\n      and you are using such a formula)._\n\n      To avoid them accidentally linking against a Pyenv-provided Python,\n      add the following line into your interactive shell's configuration:\n\n      * Bash/Zsh:\n\n        ~~~bash\n        alias brew='env PATH=\"${PATH//$(pyenv root)\\/shims:/}\" brew'\n        ~~~\n\n      * Fish:\n\n        ~~~fish\n        alias brew=\"env PATH=(string replace (pyenv root)/shims '' \\\"\\$PATH\\\") brew\"\n        ~~~\n\u003c/details\u003e\n\n#### Windows\n\n\u003cdetails\u003e\n\nPyenv does not officially support Windows and does not work in Windows outside\nthe Windows Subsystem for Linux.\nMoreover, even there, the Pythons it installs are not native Windows versions\nbut rather Linux versions running in a virtual machine --\nso you won't get Windows-specific functionality.\n\nIf you're in Windows, we recommend using @kirankotari's [`pyenv-win`](https://github.com/pyenv-win/pyenv-win) fork --\nwhich does install native Windows Python versions.\n\n\u003c/details\u003e\n\n### B. Set up your shell environment for Pyenv\n----\n\nThe below setup should work for the vast majority of users for common use cases.\nSee [Advanced configuration](#advanced-configuration) for details and more configuration options.\n\n#### Bash\n  \u003cdetails\u003e\n\n  Stock Bash startup files vary widely between distributions in which of them source\n  which, under what circumstances, in what order and what additional configuration they perform.\n  As such, the most reliable way to get Pyenv in all environments is to append Pyenv\n  configuration commands to both `.bashrc` (for interactive shells)\n  and the profile file that Bash would use (for login shells).\n\n  1. First, add the commands to `~/.bashrc` by running the following in your terminal:\n\n      ```bash\n      echo 'export PYENV_ROOT=\"$HOME/.pyenv\"' \u003e\u003e ~/.bashrc\n      echo '[[ -d $PYENV_ROOT/bin ]] \u0026\u0026 export PATH=\"$PYENV_ROOT/bin:$PATH\"' \u003e\u003e ~/.bashrc\n      echo 'eval \"$(pyenv init - bash)\"' \u003e\u003e ~/.bashrc\n      ```\n  2. Then, if you have `~/.profile`, `~/.bash_profile` or `~/.bash_login`, add the commands there as well.\n     If you have none of these, create a `~/.profile` and add the commands there.\n\n     * to add to `~/.profile`:\n       ``` bash\n       echo 'export PYENV_ROOT=\"$HOME/.pyenv\"' \u003e\u003e ~/.profile\n       echo '[[ -d $PYENV_ROOT/bin ]] \u0026\u0026 export PATH=\"$PYENV_ROOT/bin:$PATH\"' \u003e\u003e ~/.profile\n       echo 'eval \"$(pyenv init - bash)\"' \u003e\u003e ~/.profile\n       ```\n     * to add to `~/.bash_profile`:\n       ```bash\n       echo 'export PYENV_ROOT=\"$HOME/.pyenv\"' \u003e\u003e ~/.bash_profile\n       echo '[[ -d $PYENV_ROOT/bin ]] \u0026\u0026 export PATH=\"$PYENV_ROOT/bin:$PATH\"' \u003e\u003e ~/.bash_profile\n       echo 'eval \"$(pyenv init - bash)\"' \u003e\u003e ~/.bash_profile\n       ```\n\n   **Bash warning**: There are some systems where the `BASH_ENV` variable is configured\n   to point to `.bashrc`. On such systems, you should almost certainly put the\n   `eval \"$(pyenv init - bash)\"` line into `.bash_profile`, and **not** into `.bashrc`. Otherwise, you\n   may observe strange behaviour, such as `pyenv` getting into an infinite loop.\n   See [#264](https://github.com/pyenv/pyenv/issues/264) for details.\n   \n   \u003c/details\u003e\n   \n#### Zsh\n  \n  \u003cdetails\u003e\n  Add Pyenv startup commands to `~/.zshrc` by running the following in your terminal:\n  \n  ```zsh\n  echo 'export PYENV_ROOT=\"$HOME/.pyenv\"' \u003e\u003e ~/.zshrc\n  echo '[[ -d $PYENV_ROOT/bin ]] \u0026\u0026 export PATH=\"$PYENV_ROOT/bin:$PATH\"' \u003e\u003e ~/.zshrc\n  echo 'eval \"$(pyenv init - zsh)\"' \u003e\u003e ~/.zshrc\n  ```\n  \n  If you wish to get Pyenv in noninteractive login shells as well, also add the commands to `~/.zprofile` or `~/.zlogin`.\n  \u003c/details\u003e\n\n#### Fish\n\n  \u003cdetails\u003e\n\n  1. If you have Fish 3.2.0 or newer, execute this interactively:\n     ```fish\n     set -Ux PYENV_ROOT $HOME/.pyenv\n     test -d $PYENV_ROOT/bin; and fish_add_path $PYENV_ROOT/bin\n     ```\n\n  2. Otherwise, execute the snippet below:\n     ```fish\n     set -Ux PYENV_ROOT $HOME/.pyenv\n     test -d $PYENV_ROOT/bin; and set -U fish_user_paths $PYENV_ROOT/bin $fish_user_paths\n     ```\n\n  3. Now, add this to `~/.config/fish/config.fish`:\n     ```fish\n     pyenv init - fish | source\n     ```\n  \u003c/details\u003e\n\n#### Nushell\n\n  \u003cdetails\u003e\n\n  Add the following lines to your `config.nu` to add Pyenv and its shims to your `PATH`.\n  Shell integration (completions and subcommands changing the shell's state)\n  isn't currently supported.\n\n  ~~~ nu\n  $env.PYENV_ROOT = \"~/.pyenv\" | path expand\n  if (( $\"($env.PYENV_ROOT)/bin\" | path type ) == \"dir\") {\n    $env.PATH = $env.PATH | prepend $\"($env.PYENV_ROOT)/bin\" }\n  $env.PATH = $env.PATH | prepend $\"(pyenv root)/shims\"\n  ~~~\n\n  \u003c/details\u003e\n\n#### Microsoft PowerShell\n\n  \u003cdetails\u003e\n\n  Add the commands to `$profile.CurrentUserAllHosts` by running the following in your terminal:\n\n  ~~~ pwsh\n  echo '$Env:PYENV_ROOT=\"$Env:HOME/.pyenv\"' \u003e\u003e $profile.CurrentUserAllHosts\n  echo 'if (Test-Path -LP \"$Env:PYENV_ROOT/bin\" -PathType Container) { \n    $Env:PATH=\"$Env:PYENV_ROOT/bin:$Env:PATH\" }' \u003e\u003e $profile.CurrentUserAllHosts\n  echo 'iex ((pyenv init -) -join \"`n\")' \u003e\u003e $profile.CurrentUserAllHosts\n  ~~~\n\n  \u003c/details\u003e\n\n### C. Restart your shell\n----\n\n  for the `PATH` changes to take effect.\n\n  ```sh\n  exec \"$SHELL\"\n  ```\n\n### D. Install Python build dependencies\n----\n\n  [**Install Python build dependencies**](https://github.com/pyenv/pyenv/wiki#suggested-build-environment)\n  before attempting to install a new Python version.\n\n  You can now begin using Pyenv.\n\n### E. Upgrade Notes\n----\n\n**if you have upgraded from pyenv version 2.0.x-2.2.x**\n\n\u003cdetails\u003e\n\nThe startup logic and instructions have been updated for simplicity in 2.3.0.\nThe previous, more complicated configuration scheme for 2.0.0-2.2.5 still works.\n\n* Define environment variable `PYENV_ROOT` to point to the path where\n  Pyenv will store its data. `$HOME/.pyenv` is the default.\n  If you installed Pyenv via Git checkout, we recommend\n  to set it to the same location as where you cloned it.\n* Add the `pyenv` executable to your `PATH` if it's not already there\n* run `eval \"$(pyenv init -)\"` to install `pyenv` into your shell as a shell function, enable shims and autocompletion\n  * You may run `eval \"$(pyenv init --path)\"` instead to just enable shims, without shell integration\n\n\u003c/details\u003e\n\n----\n\n\n## Usage\n\n![Terminal output example](/install_local_python.gif)\n\n### Install additional Python versions\n\nTo install additional Python versions, use [`pyenv install`](COMMANDS.md#pyenv-install).\n\nFor example, to download and install Python 3.10.4, run:\n\n```sh\npyenv install 3.10.4\n```\n\nRunning `pyenv install -l` gives the list of all available versions.\n\n----\n\n\u003cdetails\u003e \u003csummary\u003e Notes about python releases \u003c/summary\u003e\n  \n**NOTE:** Most Pyenv-provided Python releases are source releases and are built\nfrom source as part of installation (that's why you need Python build dependencies preinstalled).\nYou can pass options to Python's `configure` and compiler flags to customize the build,\nsee [_Special environment variables_ in Python-Build's README](plugins/python-build/README.md#special-environment-variables)\nfor details.\n\n**NOTE:** If you are having trouble installing a Python version,\nplease visit the wiki page about\n[Common Build Problems](https://github.com/pyenv/pyenv/wiki/Common-build-problems).\n\n**NOTE:** If you want to use proxy for download, please set the `http_proxy` and `https_proxy`\nenvironment variables.\n\n**NOTE:** If you'd like a faster interpreter at the cost of longer build times,\nsee [_Building for maximum performance_ in Python-Build's README](plugins/python-build/README.md#building-for-maximum-performance).\n\n\u003c/details\u003e\n\n----\n\n#### Prefix auto-resolution to the latest version\n\nAll Pyenv subcommands except `uninstall` automatically resolve full prefixes to the latest version in the corresponding version line.\n\n`pyenv install` picks the latest known version, while other subcommands pick the latest installed version.\n\nE.g. to install and then switch to the latest 3.10 release:\n\n```sh\npyenv install 3.10\npyenv global 3.10\n```\n\nYou can run [`pyenv latest -k \u003cprefix\u003e`](COMMANDS.md#pyenv-latest) to see how `pyenv install` would resolve a specific prefix, or [`pyenv latest \u003cprefix\u003e`](COMMANDS.md#pyenv-latest) to see how other subcommands would resolve it.\n\nSee the [`pyenv latest` documentation](COMMANDS.md#pyenv-latest) for details.\n\n----\n\n#### Python versions with extended support\n\nFor the following Python releases, Pyenv applies user-provided patches that add support for some newer environments.\nThough we don't actively maintain those patches, since existing releases never change,\nit's safe to assume that they will continue working until there are further incompatible changes\nin a later version of those environments.\n\n* *3.7.8-3.7.15, 3.8.4-3.8.12, 3.9.0-3.9.7* : XCode 13.3\n* *3.5.10, 3.6.15* : MacOS 11+ and XCode 13.3\n* *2.7.18* : MacOS 10.15+ and Apple Silicon\n\u003c/details\u003e\n\n----\n\n### Switch between Python versions\n\nTo select a Pyenv-installed Python as the version to use, run one\nof the following commands:\n\n* [`pyenv shell \u003cversion\u003e`](COMMANDS.md#pyenv-shell) -- select just for current shell session\n* [`pyenv local \u003cversion\u003e`](COMMANDS.md#pyenv-local) -- automatically select whenever you are in the current directory (or its subdirectories)\n* [`pyenv global \u003cversion\u003e`](COMMANDS.md#pyenv-global) -- select globally for your user account\n\nE.g. to select the above-mentioned newly-installed Python 3.10.4 as your preferred version to use:\n\n~~~bash\npyenv global 3.10.4\n~~~\n\nNow whenever you invoke `python`, `pip` etc., an executable from the Pyenv-provided\n3.10.4 installation will be run instead of the system Python.\n\nUsing \"`system`\" as a version name would reset the selection to your system-provided Python.\n\nSee [Understanding shims](#understanding-shims) and\n[Understanding Python version selection](#understanding-python-version-selection)\nfor more details on how the selection works and more information on its usage.\n\n----\n\n#### Making multiple versions available\n\nYou can select multiple Python versions at the same time by specifying multiple arguments.\nE.g. if you wish to use the latest installed CPython 3.11 and 3.12:\n\n~~~bash\npyenv global 3.11 3.12\n~~~\n\nWhenever you run a command provided by a Python installation, these versions will be searched for it in the specified order.\n[Due to the shims' fall-through behavior]((#understanding-python-version-selection)), `system` is always implicitly searched afterwards.\n\n----\n\n### Uninstall Python versions\n\nAs time goes on, you will accumulate Python versions in your\n`$(pyenv root)/versions` directory.\n\nTo remove old Python versions, use [`pyenv uninstall \u003cversions\u003e`](COMMANDS.md#pyenv-uninstall).\n\nAlternatively, you can simply `rm -rf` the directory of the version you want\nto remove. You can find the directory of a particular Python version\nwith the `pyenv prefix` command, e.g. `pyenv prefix 2.6.8`.\nNote however that plugins may run additional operations on uninstall\nwhich you would need to do by hand as well. E.g. Pyenv-Virtualenv also\nremoves any virtual environments linked to the version being uninstalled.\n\n----\n\n### Other operations\n\nRun `pyenv commands` to get a list of all available subcommands.\nRun a subcommand with `--help` to get help on it, or see the [Commands Reference](COMMANDS.md).\n\nNote that Pyenv plugins that you install may add their own subcommands.\n\n\n## Upgrading\n\n### Upgrading with Homebrew\n\nIf you've installed Pyenv using Homebrew, upgrade using:\n```sh\nbrew upgrade pyenv\n```\n\nTo switch from a release to the latest development head of Pyenv, use:\n\n```sh\nbrew uninstall pyenv\nbrew install pyenv --head\n```\n\nthen you can upgrade it with `brew upgrade pyenv` as usual.\n\n\n### Upgrading with Installer or Git checkout\n\nIf you've installed Pyenv with Pyenv-installer, you likely have the\n[Pyenv-Update](https://github.com/pyenv/pyenv-update) plugin that would\nupgrade Pyenv and all installed plugins:\n\n```sh\npyenv update\n```\n\nIf you've installed Pyenv using Pyenv-installer or Git checkout, you can also\nupgrade your installation at any time using Git.\n\nTo upgrade to the latest development version of pyenv, use `git pull`:\n\n```sh\ncd $(pyenv root)\ngit pull\n```\n\nTo upgrade to a specific release of Pyenv, check out the corresponding tag:\n\n```sh\ncd $(pyenv root)\ngit fetch\ngit tag\ngit checkout v0.1.0\n```\n\n## Uninstalling pyenv\n\nThe simplicity of pyenv makes it easy to temporarily disable it, or\nuninstall from the system.\n\n1. To **disable** Pyenv managing your Python versions, simply remove the\n  `pyenv init` invocations from your shell startup configuration. This will\n  remove Pyenv shims directory from `PATH`, and future invocations like\n  `python` will execute the system Python version, as it was before Pyenv.\n\n    `pyenv` will still be accessible on the command line, but your Python\n    apps won't be affected by version switching.\n\n2. To completely **uninstall** Pyenv, remove _all_ Pyenv configuration lines\n  from your shell startup configuration, and then remove\n  its root directory. This will **delete all Python versions** that were\n  installed under the `` $(pyenv root)/versions/ `` directory:\n\n    ```sh\n    rm -rf $(pyenv root)\n    ```\n\n    If you've installed Pyenv using a package manager, as a final step,\n    perform the Pyenv package removal. For instance, for Homebrew:\n\n    ```\n    brew uninstall pyenv\n    ```\n\n\n## Pyenv plugins\n\nPyenv provides a simple way to extend and customize its functionality with plugins --\nas simple as creating a plugin directory and dropping a shell script on a certain subpath of it\nwith whatever extra logic you need to be run at certain moments.\n\nThe main idea is that most things that you can put under `$PYENV_ROOT/\u003cwhatever\u003e` you can also put\nunder `$PYENV_ROOT/plugins/your_plugin_name/\u003cwhatever\u003e`.\n\nSee [_Plugins_ on the wiki](https://github.com/pyenv/pyenv/wiki/Plugins) on how to install and use plugins\nas well as a catalog of some useful existing plugins for common needs.\n\nSee [_Authoring plugins_ on the wiki](https://github.com/pyenv/pyenv/wiki/Authoring-plugins) on writing your own plugins.\n\n----\n\n## How It Works\n\nAt a high level, pyenv intercepts Python commands using shim\nexecutables injected into your `PATH`, determines which Python version\nhas been specified by your application, and passes your commands along\nto the correct Python installation.\n\n\n### Understanding PATH\n\nWhen you run a command like `python` or `pip`, your shell (bash / zshrc / ...)\nsearches through a list of directories to find an executable file with\nthat name. This list of directories lives in an environment variable\ncalled `PATH`, with each directory in the list separated by a colon:\n\n    /usr/local/bin:/usr/bin:/bin\n\nDirectories in `PATH` are searched from left to right, so a matching\nexecutable in a directory at the beginning of the list takes\nprecedence over another one at the end. In this example, the\n`/usr/local/bin` directory will be searched first, then `/usr/bin`,\nthen `/bin`.\n\n\n### Understanding Shims\n\npyenv works by inserting a directory of _shims_ at the front of your\n`PATH`:\n\n    $(pyenv root)/shims:/usr/local/bin:/usr/bin:/bin\n\nThrough a process called _rehashing_, pyenv maintains shims in that\ndirectory to match every Python command across every installed version\nof Python—`python`, `pip`, and so on.\n\nShims are lightweight executables that simply pass your command along\nto pyenv. So with pyenv installed, when you run, say, `pip`, your\noperating system will do the following:\n\n* Search your `PATH` for an executable file named `pip`\n* Find the pyenv shim named `pip` at the beginning of your `PATH`\n* Run the shim named `pip`, which in turn passes the command along to\n  pyenv\n\n\n### Understanding Python version selection\n\nWhen you execute a shim, pyenv determines which Python version to use by\nreading it from the following sources, in this order:\n\n1. The `PYENV_VERSION` environment variable (if specified). You can use\n   the [`pyenv shell`](https://github.com/pyenv/pyenv/blob/master/COMMANDS.md#pyenv-shell) command to set this environment\n   variable in your current shell session.\n\n2. The application-specific `.python-version` file in the current\n   directory (if present). You can modify the current directory's\n   `.python-version` file with the [`pyenv local`](https://github.com/pyenv/pyenv/blob/master/COMMANDS.md#pyenv-local)\n   command.\n\n3. The first `.python-version` file found (if any) by searching each parent\n   directory, until reaching the root of your filesystem.\n\n4. The global `$(pyenv root)/version` file. You can modify this file using\n   the [`pyenv global`](https://github.com/pyenv/pyenv/blob/master/COMMANDS.md#pyenv-global) command.\n   If the global version file is not present, pyenv assumes you want to use the \"system\"\n   Python (see below).\n\nA special version name \"`system`\" means to use whatever Python is found on `PATH`\nafter the shims `PATH` entry (in other words, whatever would be run if Pyenv\nshims weren't on `PATH`). Note that Pyenv considers those installations outside\nits control and does not attempt to inspect or distinguish them in any way.\nSo e.g. if you are on MacOS and have OS-bundled Python 3.8.9 and Homebrew-installed\nPython 3.9.12 and 3.10.2 -- for Pyenv, this is still a single \"`system`\" version,\nand whichever of those is first on `PATH` under the executable name you\nspecified will be run.\n\n**NOTE:** You can activate multiple versions at the same time, including multiple\nversions of Python2 or Python3 simultaneously. This allows for parallel usage of\nPython2 and Python3, and is required with tools like `tox`. For example, to instruct\nPyenv to first use your system Python and Python3 (which are e.g. 2.7.9 and 3.4.2)\nbut also have Python 3.3.6, 3.2.1, and 2.5.2 available, you first `pyenv install`\nthe missing versions, then set `pyenv global system 3.3.6 3.2.1 2.5.2`.\nThen you'll be able to invoke any of those versions with an appropriate `pythonX` or\n`pythonX.Y` name.\nYou can also specify multiple versions in a `.python-version` file by hand,\nseparated by newlines. Lines starting with a `#` are ignored.\n\n[`pyenv which \u003ccommand\u003e`](COMMANDS.md#pyenv-which) displays which real executable would be\nrun when you invoke `\u003ccommand\u003e` via a shim.\nE.g. if you have 3.3.6, 3.2.1 and 2.5.2 installed of which 3.3.6 and 2.5.2 are selected\nand your system Python is 3.2.5,\n`pyenv which python2.5` should display `$(pyenv root)/versions/2.5.2/bin/python2.5`,\n`pyenv which python3` -- `$(pyenv root)/versions/3.3.6/bin/python3` and\n`pyenv which python3.2` -- path to your system Python due to the fall-through (see below).\n\nShims also fall through to anything further on `PATH` if the corresponding executable is\nnot present in any of the selected Python installations.\nThis allows you to use any programs installed elsewhere on the system as long as\nthey are not shadowed by a selected Python installation.\n\n\n### Locating Pyenv-provided Python installations\n\nOnce pyenv has determined which version of Python your application has\nspecified, it passes the command along to the corresponding Python\ninstallation.\n\nEach Python version is installed into its own directory under\n`$(pyenv root)/versions`.\n\nFor example, you might have these versions installed:\n\n* `$(pyenv root)/versions/2.7.8/`\n* `$(pyenv root)/versions/3.4.2/`\n* `$(pyenv root)/versions/pypy-2.4.0/`\n\nAs far as Pyenv is concerned, version names are simply directories under\n`$(pyenv root)/versions`.\n\n----\n\n\n## Advanced Configuration\n\nSkip this section unless you must know what every line in your shell\nprofile is doing.\n\nAlso see the [Environment variables](#environment-variables) section\nfor the environment variables that control Pyenv's behavior.\n\n`pyenv init` is the only command that crosses the line of loading\nextra commands into your shell. Coming from RVM, some of you might be\nopposed to this idea. Here's what `eval \"$(pyenv init -)\"` actually does:\n\n1. **Finds current shell.**\n   `pyenv init` figures out what shell you are using, as the exact commands of `eval \"$(pyenv init -)\"` vary depending on shell. Specifying which shell you are using (e.g. `eval \"$(pyenv init - bash)\"`) is preferred, because it reduces launch time significantly.\n\n2. **Sets up the shims path.** This is what allows Pyenv to intercept\n   and redirect invocations of `python`, `pip` etc. transparently.\n   It prepends `$(pyenv root)/shims` to your `$PATH`.\n   It also deletes any other instances of `$(pyenv root)/shims` on `PATH`\n   which allows to invoke `eval \"$(pyenv init -)\"` multiple times without\n   getting duplicate `PATH` entries.\n\n3. **Installs autocompletion.** This is entirely optional but pretty\n   useful. Sourcing `\u003cpyenv installation prefix\u003e/completions/pyenv.bash` will set that\n   up. There are also completions for Zsh, Fish and PowerShell.\n\n4. **Rehashes shims.** From time to time you'll need to rebuild your\n   shim files. Doing this on init makes sure everything is up to\n   date. You can always run `pyenv rehash` manually.\n\n5. **Installs `pyenv` into the current shell as a shell function.**\n   This bit is also optional, but allows\n   pyenv and plugins to change variables in your current shell.\n   This is required for some commands like `pyenv shell` to work.\n   The sh dispatcher doesn't do\n   anything crazy like override `cd` or hack your shell prompt, but if\n   for some reason you need `pyenv` to be a real script rather than a\n   shell function, you can safely skip it.\n\n`eval \"$(pyenv init --path)\"` only does items 2 and 4.\n\nTo see exactly what happens under the hood for yourself, run `pyenv init -`\nor `pyenv init --path`.\n\n`eval \"$(pyenv init -)\"` is supposed to run at any interactive shell's\nstartup (including nested shells -- e.g. those invoked from editors)\nso that you get completion and convenience shell functions.\n\n`eval \"$(pyenv init --path)\"` can be used instead of `eval \"$(pyenv init -)\"`\nto just enable shims, without shell integration. It can also be used to bump shims\nto the front of `PATH` after some other logic has prepended stuff to `PATH`\nthat may shadow Pyenv's shims.\n\n* In particular, in Debian-based distributions, the stock `~/.profile`\n  prepends per-user `bin` directories to `PATH` after having sourced `~/.bashrc`.\n  This necessitates appending a `pyenv init` call to `~/.profile` as well as `~/.bashrc`\n  in these distributions because the system's Pip places executables for\n  modules installed by a non-root user into those per-user `bin` directories.\n\n\n### Using Pyenv without shims\n\nIf you don't want to use `pyenv init` and shims, you can still benefit\nfrom pyenv's ability to install Python versions for you. Just run\n`pyenv install` and you will find versions installed in\n`$(pyenv root)/versions`.\n\nYou can manually execute or symlink them as required,\nor you can use [`pyenv exec \u003ccommand\u003e`](COMMANDS.md#pyenv-exec)\nwhenever you want `\u003ccommand\u003e` to be affected by Pyenv's version selection\nas currently configured.\n\n`pyenv exec` works by prepending `$(pyenv root)/versions/\u003cselected version\u003e/bin`\nto `PATH` in the `\u003ccommand\u003e`'s environment, the same as what e.g. RVM does.\n\n### Running nested shells from Python-based programs\n\nIn addition to altering `PATH`, `pyenv exec` sets `PYENV_VERSION` in the\nexecuted program's environment to ensure that it won't spontaneouly switch to\nusing a different Python version.\n\nSome Python-based programs (e.g. Jupyter) can spawn nested shell sessions.\n`pyenv version` in such a shell would dutily report that the current version was\nset by an environment variable.\n\nDepending on your use case, this version lock may be undesirable.\nIn this case, you need to change or unset the environment variable,\neither directly or via `pyenv shell`.\n\nTo automate this, you can do so in your shell's interactive startup file,\ndetecting the nested shell session via some characteristic environment variable\nthat the spawning application sets.\n\nE.g. in Jupyter's case (as of this writing), it's `JUPYTER_SERVER_ROOT`,\nand the corresponding `~/.bashrc` line may look like this:\n\n```bash\n[[ -n $JUPYTER_SERVER_ROOT ]] \u0026\u0026 unset PYENV_VERSION\n```\n\n\n\n### Environment variables\n\nYou can affect how Pyenv operates with the following environment variables:\n\nname | default | description\n-----|---------|------------\n`PYENV_VERSION` | | Specifies the Python version to be used.\u003cbr\u003eAlso see [`pyenv shell`](COMMANDS.md#pyenv-shell)\n`PYENV_ROOT` | `~/.pyenv` | Defines the directory under which Python versions and shims reside.\u003cbr\u003eAlso see [`pyenv root`](COMMANDS.md#pyenv-root)\n`PYENV_DEBUG` | | Outputs debug information.\u003cbr\u003eAlso as: `pyenv --debug \u003csubcommand\u003e`\n`PYENV_HOOK_PATH` | [_see wiki_][hooks] | Colon-separated list of paths searched for pyenv hooks.\n`PYENV_DIR` | `$PWD` | Directory to start searching for `.python-version` files.\n\nSee also [_Special environment variables_ in Python-Build's README](plugins/python-build/README.md#special-environment-variables)\nfor environment variables that can be used to customize the build.\n\n----\n\n## Development\n\nThe pyenv source code is [hosted on\nGitHub](https://github.com/pyenv/pyenv).  It's clean, modular,\nand easy to understand, even if you're not a shell hacker.\n\nTests are executed using [Bats](https://github.com/bats-core/bats-core):\n\n    bats test\n    bats/test/\u003cfile\u003e.bats\n\n\n### Contributing\n\nFeel free to submit pull requests and file bugs on the [issue\ntracker](https://github.com/pyenv/pyenv/issues).\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for more details on submitting changes.\n\n\n### Version History\n\nSee [CHANGELOG.md](CHANGELOG.md).\n\n\n### License\n\n[The MIT License](LICENSE)\n\n\n[pyenv-virtualenv]: https://github.com/pyenv/pyenv-virtualenv#readme\n[hooks]: https://github.com/pyenv/pyenv/wiki/Authoring-plugins#pyenv-hooks\n","funding_links":["https://github.com/sponsors/pyenv","https://opencollective.com/pyenv"],"categories":["Outdated Stuff","Shell","Roff","HarmonyOS","Productivity Tools","Environment Management","MultiOS","Python","开源工具","Ecosystems","Development Environment","Contributing","Programming","Local Development","环境管理","Topics Index","Python 程序","Uncategorized","List of \\*env-, ch\\*- and \\*vm- style version managers","shell","Desktop \u0026 Web Applications","Articles","🏗️ Core Features (Always Included)","Environment Management [🔝](#readme)","Package manager","Version Managers","Awesome Python","Virtual Environments","Dev - Framework Specific","Table of Contents"],"sub_categories":["Windows Manager","Python","命令行工具","[Python](https://www.python.org/)","Build and Deploy","Global Configuration","Setup","Versioning and Environments Management","网络服务_其他","Uncategorized","macOS Specific ","Environment Management","Version Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyenv%2Fpyenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyenv%2Fpyenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyenv%2Fpyenv/lists"}