Forums

This virtualenv seems to have the wrong Python version (2.7 instead of 3.4).

I have followed all the steps from django girls on how to deploy my app but it gives me the following error in my error log: This "virtualenv seems to have the wrong Python version (2.7 instead of 3.4)"

how do I clear the error? Thanks!

What command did you use to create the virtualenv on PythonAnywhere? The tutorial should tell you to use something like this:

virtualenv --python=python3.4 myvenv

...but it sounds like you might have missed out the --python=python3.4 bit.

If that's the case, you need to delete the virtualenv and then re-create it with the correct command

but I want to use version 2.7, can't that be done?

If you want to use Python 2.7, just run

virtualenv --python=python2.7 myvenv

...instead. It's entirely up to you.

but the virtualenv section of WEB tab says that I have initialized virtualenv with the wrong python version.

when you started the webapp, you specified a python version. this version is different from the virtualenv python version and that is why it is complaining.

Oh. Can I alter it now? I mean after creating the app?

No, you'll need to re-create the app, or delete the virtualenv and recreate it with the matching version of Python (depending on which version of Python you want to use in the webapp)

how can I delete the virtualenv?

You can actually change the Python version for your website now -- when Conrad said "you'll need to re-create the app" it wasn't possible, but that has changed in the meantime -- you can change the Python version from the "Web" page, in the "Code" section.

However, if you still want to delete your virtualenv, it depends on how you created it. If you used mkvirtualenv -- that is, you created it using a command like

mkvirtualenv myenv --python=python3.5

...then you can delete it by using the matching rmvirtualenv command:

rmvirtualenv myenv

Alternatively, if you created using

virtualenv --python=python3.5 myvenv

...then you just need to delete the directory myvenv that it created, either from the "Files" page or by using rm in a bash console.

I removed the virtualenv like this: rmvirtualenv myenv and did everything from the start

useful post!