If you know the name of the package you wish to install, you can install it by using this syntax: sudo apt-get install package1 package2 package3 ... You can see that it is possible to install multiple packages at one time, which is useful for acquiring all of the necessary software for a project in one step.
The pip command has options for installing, upgrading and deleting packages, and can be run from the Windows command line. By default, pip installs packages located in the Python Package Index (PyPI), but can also install from other indexes.
For installing multiple packages on the command line, just pass them as a space-delimited list, e.g.:
pip install wsgiref boto
For installing from a text file, then, from pip install --help
:
-r FILENAME, --requirement=FILENAME
Install all the packages listed in the given requirements file. This option can be used multiple times.
Take a look at the pip documentation regarding requirements files for their general layout and syntax - note that you can generate one based on current environment / site-packages with pip freeze
if you want a quick example - e.g. (based on having installed wsgiref
and boto
in a clean virtualenv):
$ pip freeze
boto==2.3.0
wsgiref==0.1.2
pip install -r requirements.txt
and in the requirements.txt file you put your modules in a list, with one item per line.
Django=1.3.1
South>=0.7
django-debug-toolbar
You can install packages listed in a text file called requirements file.
For example, if you have a file called req.txt
containing the following text:
Django==1.4
South==0.7.3
and you issue at the command line:
pip install -r req.txt
pip will install packages listed in the file at the specific revisions.
You can use the following steps:
Step 1: Create a requirements.txt with list of packages to be installed. If you want to copy packages in a particular environment, do this
pip freeze >> requirements.txt
else store package names in a file named requirements.txt
Step 2: Execute pip command with this file
pip install -r requirements.txt
Complementing the other answers, you can use the option --no-cache-dir
to disable caching in pip. My virtual machine was crashing when installing many packages at once with pip install -r requirements.txt
. What solved for me was:
pip install --no-cache-dir -r requirements.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With