피드 구독

The most popular Python package manager, pip, used to be included in a typical Python install, but lately, it's been excluded. Pip is a useful tool for running and developing Python scripts and is easy to install.

[ Get the pip cheat sheet to help you install, manage, and use Python software packages. ]

There are just two steps to install pip on Linux:

First, get the installer:

$ wget https://bootstrap.pypa.io/get-pip.py

Next, run the installer:

$ python3 ./get-pip.py

Now that you've installed pip, you might want to know more about what it's good for. Here are some basic uses of the pip command.

[ Get the guide to installing applications on Linux. ]

Install dependencies

When you download a script or an application written in Python, it may require specific Python libraries (or "modules" in Python terminology) to run. An application may not bundle support libraries along with its own code because the library isn't maintained by the same developer. If it were bundled with unrelated application code, it would be difficult for you to update it independently of the application.

Usually, a developer includes a list of dependencies in a file called requirements.txt in the application directory. If that file exists, you can process it with pip:

$ python3 -m pip install -r requirements.txt

If the developer hasn't included a list of dependencies, it's up to you to read the documentation to learn what dependencies are required.

If you install software with dnf or Flatpak, you may never have to use pip for this because those packaging systems automatically install dependencies.

Install a Python utility

You can use pip for quick installs of useful Python utilities. For instance, yamllint is a must-have command for anyone writing YAML files, whether for Kubernetes or Ansible or just for arbitrary config files. It's one pip command away:

$ python3 -m pip install yamllint

Or maybe you want to try the Ranger file manager:

$ python3 -m pip install ranger

There's a lot out there for Python, so look at Python Package Index (PyPi) to see what's available.

See installed packages

To see what Python packages are already installed, use the freeze command:

$ python3 -m pip freeze
Brlapi==0.8.2
chardet==4.0.0
chrome-gnome-shell==0.0.0
cupshelpers==1.0
dasbus==1.4
dbus-python==1.2.18
gpg==1.15.1
idna==2.10
[...]

Use pip

Pip works well for users without root access and developers using Python virtual environments. It's an easy command to use and helps you manage your Python install.

[ Learn how to manage your Linux environment for success. ]


저자 소개

Seth Kenlon is a Linux geek, open source enthusiast, free culture advocate, and tabletop gamer. Between gigs in the film industry and the tech industry (not necessarily exclusive of one another), he likes to design games and hack on code (also not necessarily exclusive of one another).

Read full bio
UI_Icon-Red_Hat-Close-A-Black-RGB

채널별 검색

automation icon

오토메이션

기술, 팀, 인프라를 위한 IT 자동화 최신 동향

AI icon

인공지능

고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트

open hybrid cloud icon

오픈 하이브리드 클라우드

하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요

security icon

보안

환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보

edge icon

엣지 컴퓨팅

엣지에서의 운영을 단순화하는 플랫폼 업데이트

Infrastructure icon

인프라

세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보

application development icon

애플리케이션

복잡한 애플리케이션에 대한 솔루션 더 보기

Original series icon

오리지널 쇼

엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리