32👍
You could use pip
to manage the package for you. If pip
is not installed.
use
sudo easy_install pip
to install it. Then
pip3 install django
would install django
for your python3.
8👍
Use python3
to call python version 3 on the command line.
For projects you can use virtual environments:
$ python # this will be version 2
$ python3 -m venv myenv
$ source myenv/bin/activate
$ python # this will be version 3
where myenv
will be the folder that hosts the libraries and binaries for that virtual environment. It will automcatically use the python version that was used to initialize this venv – in this case python3
. This has the effect that once you activate the venv you can use python
there and it will be version 3.
- Django Override Admin change_form.html Template – display associated model in template
- Using datetime to compare with dates in Django
- How to override Django admin's views?
1👍
to setup django in pyton3
- sudo apt-get install python3-pip
- sudo pip3 install virtualenv
- virtualenv -p /usr/bin/python3.X venv
- source venv/bin/activate
congrats you have setup python3 django and now have many packages to work with
Note: X stands for the version of python
- Determine if an attribute is a `DeferredAttribute` in django
- Django – how to filter out GET static and media messages with logging?
- Generate PDF with WeasyPrint having common header/footer and pagination
0👍
To install django for python3, you need to use pip3 instead of pip.
python defaults to python2.
pip defaults to pip for python2.
So, when you install pip using whatever package manager you have, you are essentially installing pip for python2.
To remove Python2: $sudo apt remove python
To install pip for python3:
$sudo apt install python3-pip
To install pip for python2:
$sudo apt install python-pip
Note: I am using apt package manager. You should use the package manager for your OS.