Upsun Developer

You may need to use a specific version of Python that isn’t available in an app container for a different language. For example, a container might have a long-term support version, while you want the latest version. In such cases, use the Pyenv version manager to install the specific version you want to use.

  1. Add your target Python version as a variable:
  1. Add Pyenv in a build hook:

Now your build hook can use the specified version of Python. You can verify this by running python --version. If you want this Python version to be available in the runtime environment, follow these steps:

  1. Copy Pyenv to your runtime environment at the end of your build hook:
  1. Create an .environment file:
  2. Update the PATH for the runtime environment:

    .environment

Now the specified Python version is used in the runtime environment.

Read the original on developer.upsun.com ↗