pip install

पैकेज और रनटाइम

इस्तेमाल

python -m pip install [-r requirements.txt] <package>

जो Python सक्रिय है उसी में package स्थापित करता है; python -m pip से बुलाने पर वह पुरानी गड़बड़ टलती है जहाँ pip किसी दूसरे interpreter का होता है, और PEP 668 के बाद system Python virtual environment के बाहर स्थापना मना कर देता है।

आम विकल्प

विकल्पअर्थ
-r <file>install everything a requirements file lists
-Uupgrade to the newest allowed version
-e .editable install of the project you are in
--userinto your home directory instead of the system
--no-depsthis package only, no dependencies
-c <file>apply a constraints file to the versions
--break-system-packagesoverride the PEP 668 refusal on a system python

उदाहरण

python -m pip install -r requirements.txt

installs a pinned set into the active environment

python -m pip install -U requests

upgrades one package

python -m pip install -e .

installs your own project so edits take effect at once

सवाल हमेशा यही है कि क्या कहाँ जाए: इस प्रोजेक्ट के भीतर, या पूरी मशीन पर।

कैसे पढ़ें

  • बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
  • तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
  • विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।

आम सवाल

Q. pip install क्या करता है?

जो Python सक्रिय है उसी में package स्थापित करता है; python -m pip से बुलाने पर वह पुरानी गड़बड़ टलती है जहाँ pip किसी दूसरे interpreter का होता है, और PEP 668 के बाद system Python virtual environment के बाहर स्थापना मना कर देता है।

Q. इसे कैसे लिखें?

python -m pip install [-r requirements.txt] <package> — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

Q. कितने विकल्प जानने लायक़ हैं?

यहाँ 7 दिए हैं; पूरी सूची man pip में है। यह कमांड पैकेज और रनटाइम में आती है।

मिलती-जुलती कमांड

man पेज: man pip-install