您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

32 行
777 B

  1. #!/usr/bin/env bash
  2. #
  3. # Summary: Activate virtual environment
  4. #
  5. # Usage: pyenv activate <virtualenv>
  6. # pyenv activate --unset
  7. #
  8. # Activate a Python virtualenv environment in current shell.
  9. # This acts almost as same as `pyenv shell`, but this invokes the `activate`
  10. # script in your shell.
  11. #
  12. # <virtualenv> should be a string matching a Python version known to pyenv.
  13. set -e
  14. [ -n "$PYENV_DEBUG" ] && set -x
  15. # Provide pyenv completions
  16. if [ "$1" = "--complete" ]; then
  17. echo --unset
  18. exec pyenv-virtualenvs --bare
  19. fi
  20. { printf "\x1B[31;1m"
  21. echo
  22. echo "Failed to activate virtualenv."
  23. echo
  24. echo "Perhaps pyenv-virtualenv has not been loaded into your shell properly."
  25. echo "Please restart current shell and try again."
  26. echo
  27. printf "\x1B[0m"
  28. } 1>&2
  29. exit 1