0

I just started using django. OS I'm using: Ubuntu 18.04.2 LTS. I created a virtual environment named mydjangoblog and i installed there django. By default it has python2 inside the folder mydjangoblog/bin I prefer that django use python3 rather than python2. HOw can I manage it?

I discovered that when I type "python" inside the terminal python2 opens. This is because The python link points to python2 according to the PEP.

this is the content of the bin folder of the virtual environment

  • Which OS are you using? –  Apr 21 '19 at 19:28
  • 1
    "My problem is that it uses by default python 2 which is installed in my Comupetr"—not exactly. It uses the Python from the environment in which you install it. Create a virtual environment using Python 3 and install Django there. This is likely a much better idea (and if your OS comes with Python a much _safer_ idea) than changing your default Python. It also has the benefit of not polluting your global Python package space. – ChrisGPT was on strike Apr 21 '19 at 19:28
  • 1
    This explains how to install to a non-default python version: https://stackoverflow.com/a/4910393/10366273 – MyNameIsCaleb Apr 21 '19 at 19:31
  • Possible duplicate of [Dealing with multiple Python versions and PIP?](https://stackoverflow.com/questions/2812520/dealing-with-multiple-python-versions-and-pip) – MyNameIsCaleb Apr 21 '19 at 19:31
  • OS I'm using: Ubuntu 18.04.2 LTS. I created a virtual environment named mydjangoblog and i installed there django. By default it has python2 inside the folder mydjangoblog/bin – Alessio Conte Apr 21 '19 at 19:47
  • When creating the virtualenv, use `-p path_to_python3` – DanielM Apr 21 '19 at 22:28

0 Answers0