← Back to Django Course | Chapter 1: Django Fundamentals & Setup | Lesson 5 of 9

pip से Django Install करना

pip वह tool है जो Django को internet से fetch करता है और इसे आपके computer पर रखता है, Python code के लिए एक app store जैसा।

पहले pip Upgrade करना

Packages install करने से पहले यह अच्छी practice है कि आप खुद pip upgrade करें, क्योंकि एक पुराना pip version नए package releases को सही से resolve करने में fail हो सकता है।

उदाहरण: Upgrading pip First

Upgrades pip to its latest version before installing other packages.

bash
pip install --upgrade pip

⚠️ Run this in your own terminal or Node.js environment.

Latest Django Install करना

बिना किसी version number के "pip install django" run करना हमेशा PyPI पर available Django का सबसे नया stable release install करता है।

उदाहरण: Installing the Latest Django

Installs the newest available version of Django.

bash
pip install django

⚠️ Run this in your own terminal or Node.js environment.

एक Specific Django Version Install करना

"==" के बाद एक version number जोड़ना, जैसे "pip install django==5.0", उस exact Django release को install करता है बजाय सबसे नए के।

Note: Versions pin करना एक project को stable रखता है जब एक नया Django release behavior बदल दे।

उदाहरण: Installing a Specific Django Version

Installs the exact Django version 5.0 instead of the latest release.

bash
pip install django==5.0

⚠️ Run this in your own terminal or Node.js environment.

Dependencies को एक File में Save करना

"pip freeze > requirements.txt" run करना हर installed package और इसका version एक file में लिख देता है, ताकि teammates बाद में exact same setup install कर सकें।

उदाहरण: Saving Dependencies to a File

Saves the currently installed packages and versions into a requirements.txt file.

bash
pip freeze > requirements.txt

⚠️ Run this in your own terminal or Node.js environment.

Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. Intended virtual environment पहले activate किए बिना pip install run करना।
  2. एक outdated pip version उपयोग करना, जो नए Django releases install करने में fail हो सकता है।
  3. एक specific Django version install करते समय number गलत type करना, जैसे "django==5..0"।
चैप्टर सारांश
  • pip Python का standard package manager है libraries install करने के लिए।
  • "pip install django" latest stable Django release install करता है।
  • आप "pip install django==5.0" से एक specific version pin कर सकते हैं।
  • Installed packages को share करने के लिए एक requirements.txt file में save किया जा सकता है।

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.