Ubuntuにdjangoをインストールする
Ubuntuにdjangoの実行環境を構築します。
今回インストールしたdjangoのバージョンはdjango2.2.3です。
Pythonのバージョン確認
事前にUbuntuにインストールされているPythonのバージョンを確認します。
user@user-VirtualBox:~$ python -V
Python 2.7.12
user@user-VirtualBox:~$ python3 -V
Python 3.5.2
user@user-VirtualBox:~$ python3.7 -V
Python 3.7.4
djangoがインストールされていないことを確認
djangoが既にインストールされていないことを確認します。
user@user-VirtualBox:~$ python3.7
Python 3.7.4 (default, Jul 31 2019, 17:27:40)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'django'
>>>
djangoのインストール
pipを使ってdjangoをインストールします。
Ubuntuにはpipとpip3がインストールされていると思いますがPython2を使用する場合はpipを、Python3を使用する場合はpip3を使用しておけば問題ないです。
user@user-VirtualBox:~$ sudo pip3 install django
djangoがインストールされたか確認します。
インストールされたdjangoのバージョンを確認します。
user@user-VirtualBox:~$ python3.7
Python 3.7.4 (default, Jul 31 2019, 17:27:40)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.VERSION
(2, 2, 3, 'final', 0)
>>>
以上です。
Discussion
New Comments
No comments yet. Be the first one!