Search code examples
pythongoogle-app-engineubuntuanacondagoogle-app-engine-python

When I run localserver on googleappengine error is "File "~/dev_appserver.py", line 102, in <module> assert sys.version_info[0] == 2 AssertionError"


I think that this problem is due to the python version. I used Anaconda with python 3.6 for learning django. Now I've to work on google app engine using python2.7. I uninstalled anaconda. Now when i run "python" I get: "Python 3.6.1 |Continuum Analytics, Inc.| (default, May 11 2017, 13:09:58)". Is there a way to default back to python2.7?

I'm on ubuntu 16.04

edit: problem is not due to python version


Solution

  • Since you are using Anaconda, you can create a new virtual environment by typing:

    conda install -n yourenvname [package]

    So with python2.7 installed:

    conda create -n python2 python=2.7 anaconda
    source activate python2
    

    And if you want to leave the virtual environment:

    source deactivate python2
    

    If you want to list all of your virtual environment:

    conda env list
    

    This way, it will not interfere with your existing python 3.6. Be aware of these command are used for conda, another command pip is for another case.