Welcome to this lesson, to develops aplication using Python at least there 3 primary element which it you must know and certainly you will do if you truly will develops aplication which is not just ‘Hello Worl‘ aplication. What is..? first you must understand about Python Package.
On all progammin language there must be a concept which called with Package repository, probably the terms different, if on Java with Maven it has Java Package repository too, if on Visual Studio there .Net, if on WordPress there Plugin etc. The concept is you can reuse the Packages, soo your aplication directly has the features which the package have. As an example if you want to developos crawler aplication or data scarper on Python you just looking the Package which it called with ‘Python Beautifulsoup‘.
By searching the package you can already doing simple Web Scraping.
Or on Desktop you can using Packahe which it called with ‘PyQt‘.
That is Python framework most important framework to develops desktop aplication, commercial aplicationlike DropBox using this framework.
Then if on website you can using Django.
Django is the most complex Python package, complete, wort to learn.
While for mobile you can using Kivy
This package that makes you can develops aplication which it run on mobile or destop all platform.
That’s the breadth about Python package or if i show you the breadth again, you know about Raspberry Pi ..?
The Raspberry Pi is small device which often using for affairs Internet of Things (IoT), it develops use Python. So if you proficient about Python you can develops aplication which run in this device.
And.. many more, you can learn Python for machine learning and many more, but we back to our concept about Python packages repository.
As you look there more website for the Packages, if you downloading to each one the website of course very troublesome. But indeed all the package listed on Pypi. All the package there on Pypy, like this example:
And of course unlikely you do searching on this website and then downloading and copying to your project. Well.. Python has tools which very usefull, the tool is ‘pip‘.
You can try it on windows or on Linux the same, example: type pip on your terminal:
If any result means already installed, but if not on Linux, type this command on your terminal:
sudo apt-get install python-pip
or if on Python 3:
sudo apt-get install python3-pip
For Ubuntu users usually already provide pip throug package, but usually default package not always up to date. Then there is best way to installing pip on windows or Linux is with using easy_install. But in windows already available, but if you’re Ubuntu users can do this command to install this package:
sudo apt-get install python-setuptools
or if Python 3:
sudo apt-get install python3-setuptools
after setuptools already installed you can call it with this command:
or if Python 3:
after already installed you can run this command:
or if Python 3:
So.. you can have Python 2 and 3 located on same system.
After pip installed, command which you will doing often is to show package already installed on system, run this command in your terminal to doing that:
There is more package already installed
And to installing Python package you just run this command:
pip install nama_package #misalnya flask pip install flask #django pip install django #machine learning pip install nltk
And if you want to uninstalling the package, just run this command:
pip uninstall nama_package #misalnya flask pip uninstall flask
And so are for the next command.
The problem is if you doing it, of course you must memorize and trying to guess what is the package name, this way probably not easy or familiar, then the best way is with using Pycharm.
Installing Package Using PyCharm
To showing in real use pip on Pycharm, as an example we will playing data scripting on Python with Beautifulsoup.
First open Beautifulsoup documentations, look at the quick start, we try to copy and paste to Pycharm
After copied, make new module on Python, the paste it on the new module:
Ok.. ceck again Beautifulsoup, then copy this code:
Then paste it again on Pycharm
If you try to look the code on the above, it will be complain beacuse we not yet installed the package. You can do as before manually search Beautifulsoup.
But Pycharm smartly, just click on the package name on the code, You can click icon lamp or directly press on your keyboard ALT+ENTER.
After installed, try to run it:
Ok.. sufficient.. that is just showing about convenience Pycharm to installing Python package which has not been installed on your system.
Ok.. thanks 🙂