1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-14 14:23:53 -05:00

Update install instructions for Bash and Zsh (#1920)

* Update install instructions for Bash and Zsh

* Synchronize README.md with `pyenv init`
* Add a ~/.bash_profile note
* Concatenate shims activation into installation for brevity
  (Pyenv can't be used meaningfully without shims anyway)
  Otherwise, we'd need to duplicate all the ~/.profile shenanigans in both sections
* Update based on feedback
* Proofread
This commit is contained in:
native-api
2021-05-13 22:57:14 +03:00
committed by GitHub
parent a7f3e3a5be
commit 0d07cda969
2 changed files with 172 additions and 101 deletions

View File

@@ -75,20 +75,29 @@ function main() {
function help_() {
case "$shell" in
bash )
profile='~/.bashrc'
profile='~/.bash_profile'
rc='~/.bashrc'
;;
zsh )
profile='~/.zshrc'
profile='~/.zprofile'
rc='~/.zshrc'
;;
ksh )
profile='~/.profile'
rc='~/.profile'
;;
* )
profile='your profile'
profile='your shell'\''s login startup file'
rc='your shell'\''s interactive startup file'
;;
esac
{
echo
echo '# (The below instructions are intended for common'
echo '# shell setups. See the README for more guidance'
echo '# if they don'\''t apply and/or don'\''t work for you.)'
echo
case "$shell" in
fish )
echo "# Add pyenv executable to PATH by running"
@@ -112,27 +121,38 @@ function help_() {
echo
;;
* )
echo "# Add pyenv executable to PATH by adding"
echo "# the following to ~/.profile:"
echo '# Add pyenv executable to PATH and'
echo '# enable shims by adding the following'
case "$shell" in
bash|ksh )
echo '# to ~/.profile:'
;;
* )
echo '# to ~/.profile and '"${profile}"':'
;;
esac
echo
echo 'export PYENV_ROOT="$HOME/.pyenv"'
echo 'export PATH="$PYENV_ROOT/bin:$PATH"'
echo 'eval "$(pyenv init --path)"'
echo
echo "# Load pyenv automatically by appending"
echo "# the following to ${profile}:"
if [[ $shell == "bash" ]]; then
echo '# If your ~/.profile sources '"${rc}"','
echo '# the lines need to be inserted before the part'
echo '# that does that.'
echo
echo '# If you have '"${profile}"', make sure that it'
echo '# also executes the above lines -- e.g. by'
echo '# copying them there or by sourcing ~/.profile'
echo
fi
echo "# Load pyenv into the shell by adding"
echo "# the following to ${rc}:"
echo
echo 'eval "$(pyenv init -)"'
echo
echo "# and the following to ~/.profile:"
echo
echo 'eval "$(pyenv init --path)"'
echo
echo '# If your ~/.profile sources '"${profile}"','
echo '# the lines should be inserted before the part'
echo '# that does that.'
echo
echo '# Make sure to restart your entire logon session'
echo '# for changes to ~/.profile to take effect.'
echo '# for changes to profile files to take effect.'
echo
;;
esac