Python package installation guide: manual and automatic methods
Most python packages are designed to be compatible with the python-pip package manager. pip is the default CLI for managing python packages. All the popular packages can be installed using pip. But some old package does not support pip installation. In such a case, we have to install the package manually. In this document, I will describe three ways of installing python packages.
1. Install package manually
The most common method for manually installing a package is using
setup.py file provided by the package developer. setup.py file normally resides inside the package folder. First, we have to navigate into the
setup.py directory from the command line.
- cd into the
Then we can install the package using the following command.
python setup.py install
To install the package in python2
python2 setup.py install
2. Install the package using pip
Almost all the package provides the command for installing the package using pip. Here is the default command for installing a package using pip.
pip install package_name
3. Install the package using conda
If we use the Anaconda environment for our project, we can manage packages easily using
conda CLI. To install
scikit-learn in anaconda we have to put the following command in conda cli.
conda install -c anaconda scikit-learn