Python library installation can be done in four ways listed below. Ideally only one of the ways should have worked! But it doesn’t! and sometimes even all these four steps also don’t work!! Simply because, python library install is a mess!!. Try installing keras or tensorflow library, you will understand what I am saying 🙂
If everything goes well, the pip command itself will successfully install your required library and you won’t have to use the other three methods.
- Using pip
- Using conda
- Using a wheel file
- manual zip file download
A library has to be installed only once using any one of the above-listed steps. Once done, then you just import the library in every session.
What happens when a library is installed?
A folder is downloaded from either the python repository(pip) or the anaconda repository(conda) and kept into the Lib/site-packages folder present inside the installation folder of your system’s python.
This is something you can perform manually as well by downloading the zip file of the library from the pypi.org but, in this case, you will have to download all the dependent packages as well, which could be cumbersome.
pip install
pip is the first command you must try in order to install a new package in python. pip will download the required package as well as its dependencies.
|
1 2 |
# Command to install textblob pip install textblob |

conda install
If pip command fails then you can use conda install command. The difference between pip and conda is the repository from where it downloads the package. pip uses the pypi.org and conda uses the anaconda repository.
|
1 2 |
# Command to install textblob library conda install textblob |

Using wheel file
A wheel file is a packaged version of a library with the required dependencies metadata and the binaries.
- Download the wheel file from the internet and put it in the Anaconda3/Scripts folder
- Fire below command from anaconda command prompt as shown
- pip install opencv_python-2.4.13.2-cp27-cp27m-win_amd64.whl

Manual zip file download
Download the zip file from the internet and put it in the Anaconda3/Lib/site-packages/ folder


Pingback: My Site