Up-to-date pip with AppEngine Python flex env?

2019-02-28 12:31发布

问题:

I want to move an app from the Python 3.7 standard environment to the Python 3.6 flex environment.

Python 3.7 comes with pip 18, Python 3.6 comes with pip 9. Pip 10 introduced a very useful feature, build dependencies. Many analytics packages need this to work, otherwise you have to install build dependencies like Cython manually in a separate step. That is obviously a non-starter in GAE.

Outside of GAE the solution is pip install --upgrade pip.

Is it possible to have the Python 3.6 environment update its pip before it runs pip install -r requirements.txt?

Adding pip to requirements.txt has no effect.

回答1:

Only python packages installable with pip (the one supplied) can be installed using the requirements.txt method.

To satisfy any other dependencies, including pip itself, you can build a custom runtime tailored exactly to your needs:

Use a custom runtime in the App Engine flexible environment to use an alternative implementation of Java, Python, Node.js, or Go, or write code in any other language. Defining new runtime environments allow you to include additional components like language interpreters or application servers.