Search code examples
pythonpython-3.xcmdcommand-linezappa

How do I make my command line use a specific version of python?


I am getting started on using Zappa. However, I already had installed python 3.7 on my computer while Zappa uses 3.6. I installed python 3.6.8, but when I try to use zappa in the cmd (zappa init) it uses python 3.7 by default. How can I direct zappa to use 3.6 instead?


Solution

  • As mentioned in Zappa README:

    Please note that Zappa must be installed into your project's virtual environment.

    You should use something like virtualenv to create a virtual environment, which makes it easy to switch Python version.

    If you use virtualenv, you can try create an environment by:

    $ virtualenv -p /usr/bin/python3.6 venv
    $ source activate venv
    

    Then pip install zappa in this virtual environment.