Hello! This is Ponta, a Shiba Inu. I'm getting used to the Mac gradually. I'm trying to install Django today, but when I tried to do it suddenly, the owner scolded me. First, create a virtual environment for Python. It's unreasonable because the text procedure that the owner skipped cleaning up didn't mention the virtual environment.
Ponta@dog # python -m venv venv_dog
You now have a virtual environment. venv is a magic trick for creating a virtual environment, the second is the directory of the virtual environment. Let's see what happens to the directories in the virtual environment.
Ponta@dog # tree -L 3
.
└── venv_dog
├── bin
│ ├── Activate.ps1
│ ├── activate
│ ├── activate.csh
│ ├── activate.fish
│ ├── easy_install
│ ├── easy_install-3.8
│ ├── pip
│ ├── pip3
│ ├── pip3.8
│ ├── python -> /Library/Frameworks/Python.framework/Versions/3.8/bin/python
│ └── python3 -> python
├── include
├── lib
│ └── python3.8
└── pyvenv.cfg
5 directories, 12 files
Now it's time to enter the Python virtual environment!
Ponta@dog # cd venv_dog/bin
Ponta@bin # source activate
(venv_dog) Ponta@bin #
Oh, the command line has changed! Owner!
(venv_dog) Ponta@bin # python -V
Python 3.8.5
(venv_dog) Ponta@bin #
One that worked!
Finally, the owner told me to install Django. Install with pip.
(venv_dog) Ponta@bin # pip install django
Collecting django
Downloading Django-3.1-py3-none-any.whl (7.8 MB)
|████████████████████████████████| 7.8 MB 3.9 MB/s
Collecting pytz
Using cached pytz-2020.1-py2.py3-none-any.whl (510 kB)
Collecting sqlparse>=0.2.2
Using cached sqlparse-0.3.1-py2.py3-none-any.whl (40 kB)
Collecting asgiref~=3.2.10
Using cached asgiref-3.2.10-py3-none-any.whl (19 kB)
Installing collected packages: pytz, sqlparse, asgiref, django
Successfully installed asgiref-3.2.10 django-3.1 pytz-2020.1 sqlparse-0.3.1
(venv_dog) Ponta@bin #
It seems to have worked, but I'll check it with pip just in case.
(venv_dog) Ponta@bin # pip list
Package Version
---------- -------
asgiref 3.2.10
Django 3.1
pip 20.2.2
pytz 2020.1
setuptools 47.1.0
sqlparse 0.3.1
(venv_dog) Ponta@bin #
It looks like you're in Django! The version is 3.1. You can also check the version by the following method.
(venv_dog) Ponta@bin # python -m django --version
3.1
(venv_dog) Ponta@bin #
That's it. See ya! Bye bye!
Recommended Posts