Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

49 lignes
1.3 KiB

  1. #!/usr/bin/env bash
  2. #
  3. # Summary: Set or show the global Python version(s)
  4. #
  5. # Usage: pyenv global <version> <version2> <..>
  6. #
  7. # Sets the global Python version(s). You can override the global version at
  8. # any time by setting a directory-specific version with `pyenv local'
  9. # or by setting the `PYENV_VERSION' environment variable.
  10. #
  11. # <version> can be specified multiple times and should be a version
  12. # tag known to pyenv. The special version string `system' will use
  13. # your default system Python. Run `pyenv versions' for a list of
  14. # available Python versions.
  15. #
  16. # Example: To enable the python2.7 and python3.7 shims to find their
  17. # respective executables you could set both versions with:
  18. #
  19. # 'pyenv global 3.7.0 2.7.15'
  20. #
  21. set -e
  22. [ -n "$PYENV_DEBUG" ] && set -x
  23. # Provide pyenv completions
  24. if [ "$1" = "--complete" ]; then
  25. echo system
  26. exec pyenv-versions --bare
  27. fi
  28. versions=("$@")
  29. PYENV_VERSION_FILE="${PYENV_ROOT}/version"
  30. if [ -n "$versions" ]; then
  31. pyenv-version-file-write "$PYENV_VERSION_FILE" "${versions[@]}"
  32. else
  33. OLDIFS="$IFS"
  34. IFS=: versions=($(
  35. pyenv-version-file-read "$PYENV_VERSION_FILE" ||
  36. pyenv-version-file-read "${PYENV_ROOT}/global" ||
  37. pyenv-version-file-read "${PYENV_ROOT}/default" ||
  38. echo system
  39. ))
  40. IFS="$OLDIFS"
  41. for version in "${versions[@]}"; do
  42. echo "$version"
  43. done
  44. fi