Day 4: Modules and pip in python

aryan015 - Jul 19 - - Dev Community

complete index🧡

Please follow me if you like my content🧡
my linkedin
website

modules

In programming modules or library are pre-written code helps you do specific task. Modules are very optimize, powerful and written by experts.

There are 2 types of modules -

  1. inbuilt - comes with python does not need explicit installation
  2. external - require installation

pip

pip is a package installer in python. It comes along with python installation does not require explicit download.

# syntax for both mac and windows
# you need active internet connection to download external packages
pip install package-name
Enter fullscreen mode Exit fullscreen mode
# preview
pip install pandas
Enter fullscreen mode Exit fullscreen mode

note: If you are coming from javascript background then you might have heard of npm. pip is python version of npm. along with it we have pipx which execute packages without downloading them. Saves space but require internet connection to use it everytime.

important internal libraries

Using below command you can see all the in-built modules.

python 
help('modules')
Enter fullscreen mode Exit fullscreen mode
  1. os: To interact with operating system features such as file system, process management, environment variables.
  2. sys: Used for interact the system but focuses on more about python runtime environment and interpreter.
  3. math: A module to solve math problems like power, log, trigonometry.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .