Address common issues with load path configuration in docs (#5356)

* Add instructions on how to add pyenv to load path

* Support zsh in pyenv load path instructions

* Make instructions for Mac work when shell-specific profile file exists

* Includes are weird...

* .

* Fix my misunderstanding of what files zsh sources

* Operator precedence, or something like that
This commit is contained in:
jack1142 2021-11-02 20:38:06 +01:00 committed by GitHub
parent 6c4e5af5ee
commit 78c92cc766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 18 deletions

View File

@ -0,0 +1,19 @@
To install/update pyenv, run the following command:
.. prompt:: bash
command -v pyenv && pyenv update || curl https://pyenv.run | bash
After this command, you will see a warning about 'pyenv' not being in the load path. To address this,
you should run these commands:
.. prompt:: bash
profile=$([ -n "$ZSH_VERSION" ] && echo ~/.zprofile || ([ -f ~/.bash_profile ] && echo ~/.bash_profile || echo ~/.profile))
rcfile=$([ -n "$ZSH_VERSION" ] && echo ~/.zshrc || echo ~/.bashrc)
printf '%s\n%s\n%s\n' 'export PYENV_ROOT="$HOME/.pyenv"' 'export PATH="$PYENV_ROOT/bin:$PATH"' "$([ -f "$profile" ] && cat "$profile")" > "$profile"
echo 'eval "$(pyenv init --path)"' >> "$profile"
echo 'eval "$(pyenv init -)"' >> "$rcfile"
echo 'eval "$(pyenv virtualenv-init -)"' >> "$rcfile"
Then **log out and log back in** and run the following command:

View File

@ -6,14 +6,7 @@ On distributions where Python 3.9 needs to be compiled from source, we recommend
This simplifies the compilation process and has the added bonus of simplifying setting up Red in a
virtual environment.
.. prompt:: bash
command -v pyenv && pyenv update || curl https://pyenv.run | bash
**After this command, you may see a warning about 'pyenv' not being in the load path. Follow the
instructions given to fix that, then close and reopen your shell.**
Then run the following command:
.. include:: _includes/_install-pyenv-and-setup-path.rst
.. prompt:: bash

View File

@ -6,14 +6,7 @@ On distributions where Python 3.8 needs to be compiled from source, we recommend
This simplifies the compilation process and has the added bonus of simplifying setting up Red in a
virtual environment.
.. prompt:: bash
command -v pyenv && pyenv update || curl https://pyenv.run | bash
**After this command, you may see a warning about 'pyenv' not being in the load path. Follow the
instructions given to fix that, then close and reopen your shell.**
Then run the following command:
.. include:: _includes/_install-pyenv-and-setup-path.rst
.. prompt:: bash

View File

@ -22,11 +22,18 @@ one-by-one:
.. prompt:: bash
brew install python@3.9
echo 'export PATH="$(brew --prefix)/opt/python@3.9/bin:$PATH"' >> ~/.profile
source ~/.profile
brew install git
brew install --cask adoptopenjdk/openjdk/adoptopenjdk11
By default, Python installed through Homebrew is not added to the load path.
To fix this, you should run these commands:
.. prompt:: bash
profile=$([ -n "$ZSH_VERSION" ] && echo ~/.zprofile || ([ -f ~/.bash_profile ] && echo ~/.bash_profile || echo ~/.profile))
echo 'export PATH="$(brew --prefix)/opt/python@3.9/bin:$PATH"' >> "$profile"
source "$profile"
.. Include common instructions:
.. include:: _includes/create-env-with-venv.rst