set python 3.6.8 default in my ubuntu

18 views
Skip to first unread message

omar ahmed

unread,
May 22, 2019, 8:48:16 AM5/22/19
to Django users
hello ..
just finished my first project with django but i can not publish it because my default python is python 2.7.12 and Heroku now does not support it ..
now i installed python 3.6.8 .... how can i set it as default python version to make my projects with virtualenv ?
thanks in advance

Nick Sarbicki

unread,
May 22, 2019, 9:09:37 AM5/22/19
to Django users
Hi Omar,

It is generally recommended to _not_ set python3 as your system default. This is stated in PEP 394. The reasoning being there may be internal and third party processes which still expect the default python to be 2.x. Updating the default to python3 will likely break these and could cause unexpected problems.

You can however create a virtualenv with python3 by simply running virtualenv env -p python3.

It is also worth noting that as far as I know Heroku does support python3. There is some documentation on this here.

- Nick


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2dafe695-66c0-42a3-b92e-a71881401ab7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

omar ahmed

unread,
May 22, 2019, 9:21:54 AM5/22/19
to Django users
ok .. i did it but it make my env with python3.5


On Wednesday, May 22, 2019 at 3:09:37 PM UTC+2, Nick Sarbicki wrote:
Hi Omar,

It is generally recommended to _not_ set python3 as your system default. This is stated in PEP 394. The reasoning being there may be internal and third party processes which still expect the default python to be 2.x. Updating the default to python3 will likely break these and could cause unexpected problems.

You can however create a virtualenv with python3 by simply running virtualenv env -p python3.

It is also worth noting that as far as I know Heroku does support python3. There is some documentation on this here.

- Nick


On Wed, May 22, 2019 at 1:48 PM omar ahmed <omark...@gmail.com> wrote:
hello ..
just finished my first project with django but i can not publish it because my default python is python 2.7.12 and Heroku now does not support it ..
now i installed python 3.6.8 .... how can i set it as default python version to make my projects with virtualenv ?
thanks in advance

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.

Aldian Fazrihady

unread,
May 22, 2019, 9:27:36 AM5/22/19
to django...@googlegroups.com
Omar, if you upgraded your system to Ubuntu 18.04,  it will install Python 3.6 for you.


Aldian Fazrihady

To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Chetan Ganji

unread,
May 22, 2019, 9:48:56 AM5/22/19
to django...@googlegroups.com
Hi Omar,

I have added these settings to me ~/.bashrc file in Kubuntu 18.04.
Same would work for rest of the linux with minor changes.
First group would be your answer. 
Second groups of lines are used for virtualenv settings
Third group of lines are to make my life easier by saving me typing the same commands over and over. These are the 3 commands that I use most of the time.


# *************************** RyuCoder Settings Start ********************************

alias python=python3.7
alias python3=python3.7
alias pip='python3.7 -m pip'
alias sudopip='sudo python3.7 -m pip'

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.7
export WORKON_HOME=~/ENV
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh

alias run='python manage.py runserver'
alias migrations='python manage.py makemigrations'
alias migrate='python manage.py migrate'

# *************************** RyuCoder Settings End ********************************



Regards,
Chetan Ganji
+91-900-483-4183


omar ahmed

unread,
May 22, 2019, 10:18:06 AM5/22/19
to Django users
thank you nick it works

johnpaul mulongo

unread,
May 22, 2019, 1:22:59 PM5/22/19
to Django users
You could also try to check out pyenv. It's a pretty handy when dealing with python versions.

James Schneider

unread,
May 22, 2019, 1:24:55 PM5/22/19
to django...@googlegroups.com
No
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages