close

How to run Pip commands from CMD

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to run Pip commands from CMD in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to run Pip commands from CMD?

  1. How to run Pip commands from CMD?

    Newer versions of Python come with py, the Python Launcher, which is always in the PATH.
    Here is how to invoke pip via py:

  2. run Pip commands from CMD

    Newer versions of Python come with py, the Python Launcher, which is always in the PATH.
    Here is how to invoke pip via py:

Method 1

To execute Pip, first of all make sure you have it installed, so type in your CMD:

> python
>>> import pip
>>>

And it should proceed with no error. Otherwise, if this fails, you can look h

ere to see how to install it. Now that you are sure you’ve got Pip, you can run it from CMD with Python using the -m (module) parameter, like this:

> python -m pip <command> <args>

Where <command> is any Pip command you want to run, and <args> are its relative arguments, separated by spaces.

For example, to install a package:

> python -m pip install <package-name>

Method 2

Newer versions of Python come with py, the Python Launcher, which is always in the PATH.

Here is how to invoke pip via py:

py -m pip install <packagename>

py allows having several versions of Python on the same machine.

As an example, here is how to invoke the pip from Python 2.7:

py -2.7 -m pip install <packagename>

Conclusion

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read