Sunday 24 September 2017

Installing package in python the easy way

Every programming languange or scripting langguange or any computer language has its own tools to make the job easier and done faster. Come with python is their installation systems.

For installing package in python, there are several ways to do it. You can download the source, unzip and run python setup.py install , or using a package installer which will download the package you specify and also download its dependency.

I choose to use pip package installer. It is lot easier and faster with pip. If you use python > 2.7.9 pip already included in python installation. If not come along for installing pip.

First get the get-pip.py file from Here . The script will installing pip for you when your run i.
After download it, do python get-pip.py as root.

After complete you can pip install package-name , and it will download and install all the python package from python repo.

If you have your development machine with all the required package installed, and you want to move your machine, cumbersome task right to install from start again. You can make it easier using pip freeze. It will list you all the python package installed. Just dump it on a pip file with this command :

pip freeze > requirements.txt

Then in your new machine, transfer your file requirements.txt using this command :

pip install -r requirements.txt

Then all the package will installed in your new shiny machine.

Have a good python experience.


0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More