• Programming
  • Tutorial
  • System Administration
  • Gadgets
  • Phones
  • Web development
Saturday, July 2, 2022
  • Login
No Result
View All Result
SkilledRoom
No Result
View All Result
SkilledRoom
No Result
View All Result
Home Programming

Pip: how to install packages in Python

December 3, 2021
in Programming
Share on FacebookShare on Twitter

Pip is a package manager for Python and can be accessed through the command line. Pip does not need to be installed separately if you are using Python 2.7.9 or later, or 3.4 or later. If pip is installed, then you can enter in the command line:

pip

The commands in this article are for Windows, pip work in Linux may differ.

You will get help with basic commands.

Install pip for Python

If pip is not installed, then you need to download the script . Select the folder with your Python version number. After that, in the command line, go to the folder with the script and run the command:

python get-pip.py

If pip is installed in the ProgramFiles folder, then you need to run command line as administrator.

If you installed pip but still get an error in the console, you need to specify the path to the pip.exe file in the Path variable. To do this, go to Computer Properties> Advanced System Settings> Environment Variables. Here (depending on the Windows version), either add the path to the already existing one separated by semicolons, or just click New and copy the path into a new field.

If you need to upgrade pip write on the command line:

python -m pip install --upgrade pip

Package management

To install a package from pypi.org,  enter in the console:

python -m pip install ИмяПакета

If you need to use several versions of pip, then the one you need can be specified like this (starting from version pip 0.8):

pip-0.8 install ИмяПакета

You can select the Python version in the same way:

python-3.6 -m pip install ИмяПакета

Pip version 1.5 and higher should be specified like this:

pip2.6 install ИмяПакета

To update the package enter:

python -m pip install --upgrade ИмяПакета

To uninstall a package, use the uninstall command:

python -m pip uninstall ИмяПакета

The -m flag is used to run the installed module as a script (if you write pip without -m you may get an error).

You can display a list of all installed packages to a file using:

pip freeze > requirements.txt // название файла может быть любым

If there is such a file, you can install packages in groups:

pip install -r requirements.txt// версии пакетов в файле указывать не обязательно

The required packages can be found without going to pyPi.org (currently not available ):

pip search строка для поиска

To find out the details of an installed package, enter:

pip show ИмяПакета

You can check if all the dependencies for your packages are installed like this:

pip check

Now, with this knowledge, you can download the cowsay package yourself, go into python, and enter this text:

>>> import cowsay
>>> cowsay.cow('Я умею работать с pip! Му!')

Ready! You have a talking console cow:

Tags: Python
Previous Post

Python Desktop Application: UI and Signals

Next Post

40 JavaScript Techniques You Should Know

Related Posts

5 Ways to Reduce JavaScript Package Size

5 Ways to Reduce JavaScript Package Size

by skilled
December 3, 2021
0

JavaScript is used heavily in modern web development. And the packages of many applications are getting quite large. It seems to be...

40 JavaScript Techniques You Should Know

40 JavaScript Techniques You Should Know

by skilled
December 3, 2021
0

JavaScript is a programming language used to build web pages and mobile applications. If you've been learning JS for a while...

Python vs C ++ speed comparison

Python vs C ++ speed comparison

by skilled
December 3, 2021
0

An example for data scientists who think they don't need to learn C ++ Prim. row.This is a translation of Nazer...

Next Post
40 JavaScript Techniques You Should Know

40 JavaScript Techniques You Should Know

5 Ways to Reduce JavaScript Package Size

5 Ways to Reduce JavaScript Package Size

Galaxy S21 Ultra, good for movies: how spectacular is the first feature film with a Samsung phone

Galaxy S21 Ultra, good for movies: how spectacular is the first feature film with a Samsung phone

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Home
  • About Us
  • Advertise
  • Privacy & Policy
  • Contact Us

© 2017 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Programming
  • Tutorial
  • System Administration
  • Gadgets
  • Phones
  • Web development

© 2017 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Create New Account!

Fill the forms below to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In