這幾天在複習 Django 時發現它已升版至 3.1.3 版, 所以把筆電的 Django 也提升至最新版, 以下是在虛擬環境 virtualenv 中安裝, 參考 :
D:\>cd django
D:\django>virtualenv venv
created virtual environment CPython3.7.2.final.0-64 in 5360ms
creator CPython3Windows(dest=D:\django\venv, clear=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\User\AppData\Local\pypa\virtualenv)
added seed packages: pip==20.2.4, setuptools==50.3.2, wheel==0.35.1
activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
這會建立一個虛擬環境目錄 venv, 進入其下子目錄 Scripts 執行 activate 程式進入虛擬環境, 然後安裝 Django 最新版 :
D:\django>cd venv
D:\django\venv>Scripts\activate
(venv) D:\django\venv>pip install django
Collecting django
Downloading Django-3.1.3-py3-none-any.whl (7.8 MB)
Collecting sqlparse>=0.2.2
Downloading sqlparse-0.4.1-py3-none-any.whl (42 kB)
Collecting pytz
Downloading pytz-2020.4-py2.py3-none-any.whl (509 kB)
Collecting asgiref<4,>=3.2.10
Downloading asgiref-3.3.1-py3-none-any.whl (19 kB)
Installing collected packages: sqlparse, pytz, asgiref, django
Successfully installed asgiref-3.3.1 django-3.1.3 pytz-2020.4 sqlparse-0.4.1
可見除了安裝 Django 3 之外, 還會安裝 pytz, sqlparse, asgiref 這三個相依套件. 用 pip list 檢視虛擬環境中已安裝套件 :
(venv) D:\django\venv>pip3 list
Package Version
---------- -------
asgiref 3.3.1
Django 3.1.3
pip 20.2.4
pytz 2020.4
setuptools 50.3.2
sqlparse 0.4.1
wheel 0.35.1
查詢 Django 版本 :
(venv) D:\django\venv>python -m django --version
3.1.3
Django 3.1 版的新功能參考發布版本通知 :
GitHub 上有一個很不錯的 Django 3.1 線上教學網站可參考 :
Awesome cool mate, even if it is in Chinese, google translate had translated it well. BTW check out my website rafled.com. It provides tools for developers for free. No signup needed ;).
回覆刪除