search
HomeBackend DevelopmentPython TutorialHow to fix pip not recognized as an internal or external command: a simple guide

How to fix pip not recognized as an internal or external command: a simple guide

Teach you step by step how to solve the problem that pip is not an internal or external command

When developing in Python, you often need to use pip to install third-party libraries. However, sometimes we encounter a common problem, that is, when executing the pip command in the command prompt or terminal, the system prompts "pip is not an internal or external command." The solution to this problem is actually very simple. Below I will explain in detail how to solve this problem, including specific code examples.

The reason for the problem is that the system cannot find the path where the pip command is located. To solve this problem, we need to do two steps:

Step 1: Confirm whether the Python environment variable has been configured

Enter "python" in the command prompt or terminal, if you can enter normally Python interactive environment, indicating that the Python environment variables have been configured correctly. If you cannot enter the Python interactive environment normally, it means that the Python environment variables are not configured or are configured incorrectly.

In order to solve this problem, we need to manually add the Python installation path to the system environment variables. The following are the specific steps:

  1. Open the Control Panel and click "System and Security".
  2. Click "System" and then click "Advanced System Settings".
  3. Under the "Advanced" tab, click "Environment Variables".
  4. Find the variable named "Path" in the list of "System Variables" and double-click to open it.
  5. In the "Edit Environment Variables" dialog box, click "New".
  6. Enter the installation path of Python (for example, C:Python37), and then click "OK".
  7. Make sure the newly added path is in the list of the "Path" variable, and then click "OK" to close the window.
  8. Reopen in the command prompt or terminal, enter "python", and check whether you can enter the Python interactive environment normally.

Step 2: Make sure the path where the pip command is located has been added to the system's environment variables

Some versions of Python will automatically add the pip command to the system's environment variables during installation. , but some versions are not added automatically. Therefore, we need to manually add the path where the pip command is located to the system's environment variables. The following are the specific steps:

  1. Open the Control Panel and click "System and Security".
  2. Click "System" and then click "Advanced System Settings".
  3. Under the "Advanced" tab, click "Environment Variables".
  4. Find the variable named "Path" in the list of "System Variables" and double-click to open it.
  5. In the "Edit Environment Variables" dialog box, click "New".
  6. Enter the path where the pip command is located (such as C:Python37Scripts), and then click "OK".
  7. Make sure the newly added path is in the list of the "Path" variable, and then click "OK" to close the window.
  8. Reopen in the command prompt or terminal, enter "pip", and check whether the pip command can be executed normally.

Through the above two steps, we can solve the problem that pip is not an internal or external command. The following is a specific code example:

Try to execute the python command to check whether the Python environment is configured correctly:

$ python
Python 3.7.2 (default, Dec 27 2018, 07:35:06)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

If you can enter the Python interactive environment normally, it means the Python environment Already configured correctly. Otherwise, follow step 1 above to add the Python installation path to the system environment variables.

Then, try to execute the pip command to check whether the pip command can be executed:

$ pip
Usage: pip <command> [options]

Commands:
...

If it can run normally, congratulations, the problem has been solved! If the prompt "pip is not an internal or external command" is still prompted, follow step 2 above and add the path where the pip command is located to the system's environment variables.

With the above steps and code examples, you should be able to successfully solve the problem that pip is not an internal or external command. When using pip, remember to update and upgrade pip in time to maintain the latest features and bug fixes. Hope this article is helpful to you!

The above is the detailed content of How to fix pip not recognized as an internal or external command: a simple guide. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
PHP Warning: mysqli_query(): Empty query的解决方法PHP Warning: mysqli_query(): Empty query的解决方法Jun 22, 2023 pm 04:45 PM

在使用PHP开发Web应用时,经常会遇到各种各样的问题。其中,一些常见的问题是与MySQL数据库相关的问题。有一种问题是“PHPWarning:mysqli_query():Emptyquery”的错误。本文将介绍此错误的原因以及解决方法。首先,让我们看看这个错误表示什么。当您使用mysqli_query函数执行MySQL查询时,如果该查询为空,则会

PHP Notice: Undefined property: stdClass::$的解决方法PHP Notice: Undefined property: stdClass::$的解决方法Jun 22, 2023 pm 10:24 PM

在使用PHP编写代码时,我们经常会看到这样的错误提示:“PHPNotice:Undefinedproperty:stdClass::$”。这个错误提示通常是由于在使用对象的属性时,该属性不存在而引起的。在本文中,我们将讨论如何解决这个问题。首先,我们需要了解这个错误提示的原因。当我们使用对象的属性时,PHP会首先检查该属性是否存在。如果该属性不存在,

PHP Fatal error: Cannot redeclare的解决方法PHP Fatal error: Cannot redeclare的解决方法Jun 22, 2023 pm 07:43 PM

在使用PHP进行开发的过程中,有时候会遇到“PHPFatalerror:Cannotredeclare”错误,这个错误通常会出现在如下情况:在PHP代码中多次include/require同一个文件。在代码中定义了和已有的函数/类重名的函数/类。这个错误会导致程序无法继续执行,为了解决这个问题,我们需要了解其产生原因和解决方法。产生原

PHP Warning: date() expects parameter 2 to be long, string given的解决方法PHP Warning: date() expects parameter 2 to be long, string given的解决方法Jun 22, 2023 pm 08:03 PM

在使用PHP程序开发时,经常会碰到一些警告或者错误的提示信息。其中,可能出现的一个错误提示就是:PHPWarning:date()expectsparameter2tobelong,stringgiven。这个错误的提示信息意思是:函数date()的第二个参数期望是长整型(long),但是实际传递给它的是字符串(string)。那么,我们

PHP Notice: Trying to get property ‘的解决方法’ of non-object的解决方法PHP Notice: Trying to get property ‘的解决方法’ of non-object的解决方法Jun 22, 2023 am 11:51 AM

当我们在使用PHP进行开发时,有时会遇到”Tryingtogetproperty‘的解决方法’ofnon-object”的错误提示。这个错误的原因一般是因为程序中对一个不存在或者未实例化的对象进行访问,导致了PHP解析器无法识别该对象的属性或方法。那么,如何解决这个错误呢?下面我将为大家介绍几种可能的解决方法。一、检查代码首先,我们需要将出错的代

TranslucentTB不起作用:如何解决TranslucentTB不起作用:如何解决Jun 06, 2023 am 08:21 AM

TranslucentTB是寻求时尚简约桌面外观的Windows11爱好者广泛使用的工具,遇到了障碍。自从发布以来Windows11内部版本22621.1344(22H2)28年2023月日,TranslucentTB对大多数用户不起作用。此错误使用户努力应对其任务栏的有限自定义选项。用户在寻求克服这一挫折的解决方案时,挫败感显而易见。在最近的Windows11更新之后,TranslucentTB无法正常工作的问题已在多个在线平台上广泛报道,包括论坛和社交媒体。用户一直在分享他们的经验,拼命寻找

PHP Notice: Undefined index:的解决方法PHP Notice: Undefined index:的解决方法Jun 22, 2023 am 10:15 AM

当使用PHP开发Web应用程序时,经常会遇到“PHPNotice:Undefinedindex:”这样的错误消息。此错误消息通常与数组相关。在PHP中,当我们使用未定义的数组索引时,就会收到这种类型的错误消息。这通常会发生在以下情况下:尝试访问不存在的数组元素尝试使用错误的键来访问数组在本文中,我们将探讨如何解决此错误,并提供一些常见的应用程序开发实践

PHP Notice: Undefined property: stdClass::$name的解决方法PHP Notice: Undefined property: stdClass::$name的解决方法Jun 22, 2023 pm 10:09 PM

在使用PHP开发项目时,经常会遇到各种警告和错误信息。其中,PHPNotice:Undefinedproperty:stdClass::$name是比较常见的一种警告提示。这种提示通常出现在尝试访问一个对象属性,但该属性并不存在的情况下。本文将介绍这种警告的解决方法。原因分析在PHP中,stdClass是一个类似于数组的标准类,在没有指定类的情况下创

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function