In order to use Python 3.3 & Django 1.8, I'm using Virtualenv (for a web app in PythonAnywhere)
I followed the following instructions: https://help.pythonanywhere.com/pages/VirtualEnvForNewerDjango
Going into the console, it shows that I'm using version 3.3:
(django18)12:04 ~ $ python
Python 3.3.6 (default, Jan 28 2015, 17:27:09)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Which is also the version I specified I want to use in my web app:
Python version:3.3 (in the code pane)
However, when I point in the Virtualenv pane to the Virtualenv directory (named django18), I get the following warning:
This virtualenv seems to have the wrong Python version (2.7 instead of 3.3).
Here is all of the console (I've run it after creating the application and specifying the Python version):
06:43 ~ $ mkvirtualenv --python=/usr/bin/python3.3 django18
Running virtualenv with interpreter /usr/bin/python3.3
Using base prefix '/usr'
New python executable in django18/bin/python3.3
Not overwriting existing python script django18/bin/python (you must use django18/b
in/python3.3)
Installing setuptools, pip, wheel...done.
(django18)06:44 ~ $ which pip
/home/yschellekens/.virtualenvs/django18/bin/pip
(django18)06:44 ~ $ pip install django
Requirement already satisfied (use --upgrade to upgrade): django in ./.virtualenvs/
django18/lib/python3.3/site-packages
(django18)06:44 ~ $ which django-admin.py
/home/yschellekens/.virtualenvs/django18/bin/django-admin.py
(django18)06:44 ~ $ django-admin.py --version
1.8.3
(django18)06:44 ~ $ django-admin.py startproject mysite
CommandError: '/home/yschellekens/mysite' already exists
Also see:
08:29 ~/.virtualenvs/django18/bin $ ls
__pycache__ django-admin.py pip postdeactivate python3
activate django-admin.pyc pip2 preactivate python3.3
activate.csh easy_install pip2.7 predeactivate wheel
activate.fish easy_install-2.7 pip3 python
activate_this.py easy_install-3.3 pip3.3 python2
django-admin get_env_details postactivate python2.7
08:29 ~/.virtualenvs/django18/bin $
Where else should I point to Python 3.3?
It looks to me like your virtualenv has somehow got both version 2.7 and version 3.3 of Python in it. Try deleting it and re-creating it:
rmvirtualenv django18
mkvirtualenv --python=/usr/bin/python3.3 django18
pip install django # reinstall django and any other packages you need.
Why not use Python 3.4 by the way?
Not overwriting existing python script django18/bin/python
Because you are creating env with python 2.7 and then with python 3.3, the django18/bin/python script is still pointing at python 2.7. Edit django18/bin/python
or remove the env and only use the mkvirtualenv --python=/usr/bin/python3.3 django18
command.
Old answer:
From the link you provided:
TIP: if you want to use Python 3 for your virtualenv, use mkvirtualenv --python=/usr/bin/python3.4 django18
https://www.pythonanywhere.com/wiki/VirtualEnvForNewerDjango
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With