Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tut] ‘Pip’ Is Not Recognized As An Internal Or External Command [FIXED]

#1
‘Pip’ Is Not Recognized As An Internal Or External Command [FIXED]

<div><div id="ez-toc-container" class="ez-toc-v2_0_18 counter-hierarchy counter-decimal ez-toc-light-blue">
<div class="ez-toc-title-container">
<p class="ez-toc-title">Table of Contents</p>
<p><span class="ez-toc-title-toggle"><a class="ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle" style="display: none;"><i class="ez-toc-glyphicon ez-toc-icon-toggle"></i></a></span></div>
<nav>
<ul class="ez-toc-list ez-toc-list-level-1">
<li class="ez-toc-page-1 ez-toc-heading-level-2"><a class="ez-toc-link ez-toc-heading-1" href="https://blog.finxter.com/pip-is-not-recognized-as-an-internal-or-external-command-fixed/#%E2%9D%92What_Are_Environment_Variables" title="❒What Are Environment Variables?">❒What Are Environment Variables?</a>
<ul class="ez-toc-list-level-3">
<li class="ez-toc-heading-level-3"><a class="ez-toc-link ez-toc-heading-2" href="https://blog.finxter.com/pip-is-not-recognized-as-an-internal-or-external-command-fixed/#Features_Of_Environment_Variables" title="Features Of Environment Variables">Features Of Environment Variables</a></li>
<li class="ez-toc-page-1 ez-toc-heading-level-3"><a class="ez-toc-link ez-toc-heading-3" href="https://blog.finxter.com/pip-is-not-recognized-as-an-internal-or-external-command-fixed/#Examples_Of_Environment_Variables" title="Examples Of Environment Variables">Examples Of Environment Variables</a></li>
</ul>
</li>
<li class="ez-toc-page-1 ez-toc-heading-level-2"><a class="ez-toc-link ez-toc-heading-4" href="https://blog.finxter.com/pip-is-not-recognized-as-an-internal-or-external-command-fixed/#%E2%9D%92Solution_1_Ensure_Pip_Is_Installed_Correctly_And_Up-to-date" title="❒Solution 1: Ensure Pip Is Installed Correctly And Up-to-date">❒Solution 1: Ensure Pip Is Installed Correctly And Up-to-date</a>
<ul class="ez-toc-list-level-3">
<li class="ez-toc-heading-level-3"><a class="ez-toc-link ez-toc-heading-5" href="https://blog.finxter.com/pip-is-not-recognized-as-an-internal-or-external-command-fixed/#Windows" title="Windows">Windows</a></li>
<li class="ez-toc-page-1 ez-toc-heading-level-3"><a class="ez-toc-link ez-toc-heading-6" href="https://blog.finxter.com/pip-is-not-recognized-as-an-internal-or-external-command-fixed/#Linux" title="Linux">Linux</a></li>
</ul>
</li>
<li class="ez-toc-page-1 ez-toc-heading-level-2"><a class="ez-toc-link ez-toc-heading-7" href="https://blog.finxter.com/pip-is-not-recognized-as-an-internal-or-external-command-fixed/#%E2%9D%92Solution_2_Add_The_Path_Of_Pip_Installation_To_The_PATH_System_Variable" title="❒Solution 2: Add The Path Of Pip Installation To The PATH System Variable">❒Solution 2: Add The Path Of Pip Installation To The PATH System Variable</a></li>
<li class="ez-toc-page-1 ez-toc-heading-level-2"><a class="ez-toc-link ez-toc-heading-8" href="https://blog.finxter.com/pip-is-not-recognized-as-an-internal-or-external-command-fixed/#Conclusion" title="Conclusion">Conclusion</a></li>
</ul>
</nav>
</div>
<p>Many factors could lead to the error: <em>‘pip’ is not recognized as an internal or external command</em>. Two of the most common ones are Python’s or pip’s incorrect installation and lacking path in the system environment variables.</p>
<p>This tutorial deeply explains the concept of environment variables, system paths, and pip’s way of storing packages to enable you to track the source of the error comfortably.</p>
<p>It then takes you through a step-by-step way to solve the error. Apart from Windows, you will see how to solve related errors in Linux. What is more? Read on to find out.</p>
<h2>❒<strong>What Are Environment Variables?</strong></h2>
<p>Understanding environment variables is one the most crucial steps to solving pip’s errors.</p>
<p>A computing environment is a platform consisting of the operating system and the processor. On the other hand, a variable is a place for storing a value. The variable can be binary, text, number, filename, or any other data type. It gets its name during creation and can be displayed, updated, and deleted.</p>
<p>The combination of a computing environment and variable is an environment variable, a dynamic value affecting the behavior of a computer process. A computer process is an instance of a program.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># Determine the value of a variable
echo %VARIABLE% # in Windows
echo $VARIABLE # in Linux # display
%VARIABLE% # in Windows
env # command for printing all environment variables OR
printenv # show a single environment variable in Linux.</pre>
<h3><strong>Features Of Environment Variables</strong></h3>
<ul>
<li>They can be created, read, edited, and deleted.</li>
<li>Each process has its set of environment variables. A newly created process inherits its parent’s same runtime environment.</li>
<li>Environment variables occur in scripts and the command line.</li>
<li>Shell scripts and batch files use environment variables to communicate data and processes to child processes or temporarily store data.</li>
<li>A running process can access the environment variables for configuration reasons.</li>
<li>A collection of environment variables behave like an associative array, with keys and values in strings.</li>
<li>Environment variables may differ depending on the operating system.</li>
<li>Windows stores the default environment variable values in the registry and sets them in the AUTOEXEC.BAT file.</li>
</ul>
<h3><strong>Examples Of Environment Variables</strong></h3>
<p>Here are the typical environment variables that interact with pip.</p>
<p><strong>PATH</strong></p>
<p>The path variable lists the directory where your system searches executables. It enables you to view the location of a directory without typing the full path.</p>
<p>In Windows, the path variables are stored in C:\Windows or C:\Windows\System32. In Linux, they originate from the user’s bin or sbin file.</p>
<p><strong>HOME</strong></p>
<p>It shows the default path to the user’s home directory. For instance, HOME//APPDATA stores app settings in Windows. In Linux, the settings are found in HOME/{.App Name}.</p>
<p>In Windows, the misplaced APPDATA lands in the USERPROFILE environment variable, which should instead be used for dialogs to allow a user to choose between folders. LOCALAPPDATA stores local app settings.</p>
<p><strong>TEMP</strong></p>
<p>It stores temporary processes.</p>
<p>Now that you understand how environment variables play a massive in package working, you should find out specific ways to solve pip’s errors.</p>
<h2>❒<strong>Solution 1: Ensure Pip Is Installed Correctly And Up-to-date</strong></h2>
<h3><strong>Windows</strong></h3>
<p>Pip packages are stored in Python’s installation directory. For instance, installing Python in <code>C:\Python\</code> stores the default library in <code>C:\Python\Lib\</code>, while the third-party packages reside in <code>C:\Python\Lib\site-packages</code>.</p>
<p>If you install a specific Python version as a stand-alone, pip packages reside in APPDATA.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">C:\Users\&lt;username&gt;\AppData\Roaming\Python\Python&lt;version-subversion&gt;\site-packages\ # the version can be 310 for Python 3.10 or 38 for Python 3.8</pre>
<p>If you install a pip package that does not use a specific location, it lands in Scripts.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">C:\Python310\Scripts\ </pre>
<p>Pip gets installed by default when you install most Python 3 versions. You can confirm the installation by checking the pip’s version or help command.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pip -V
# OR
pip help</pre>
<figure class="wp-block-image size-large is-style-default"><img loading="lazy" width="1024" height="763" src="https://blog.finxter.com/wp-content/uploads/2022/04/check-version-1024x763.png" alt="" class="wp-image-302354" srcset="https://blog.finxter.com/wp-content/uploads/2022/04/check-version-1024x763.png 1024w, https://blog.finxter.com/wp-content/uplo...00x224.png 300w, https://blog.finxter.com/wp-content/uplo...68x572.png 768w, https://blog.finxter.com/wp-content/uplo...ersion.png 1300w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
<p>You should get pip’s version version, installation folder, and Python version running it.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pip 22.0.4 from C:\Users\&lt;username&gt;\AppData\Local\Programs\Python\Python310\lib\site-packages\pip (python 3.10)</pre>
<p>Otherwise, you could get an error,</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">'pip' is not recognized as an internal or external command</pre>
<p>OR</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Python is not recognized as an internal or external command, operable program or batch file.</pre>
<p>if you try running python.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">python</pre>
<p>If you run the above commands without seeing Python, pip, or the installed package, you should <a href="https://www.python.org/downloads/">download Python</a>.</p>
<p>Install pip as a stand-alone package if pip is still unavailable after installing Python. <a href="https://bootstrap.pypa.io/get-pip.py">Download get-pip</a>, and run the following command on the command prompt.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">python get-pip.py</pre>
<p>Lastly, you can upgrade the pip version and check if the error persists.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">python -m pip install --upgrade pip</pre>
<p>If the problem is still not solved, try adding Python to the system path variable, as explained in solution 2 of this tutorial.</p>
<h3><strong>Linux</strong></h3>
<p>The <code>usr</code> is one of the most crucial folders in Linux. It stores information like user binaries, libraries, documentation, and header files. It is where packages that pip manages get installed.</p>
<p>Say we want to install Python 3.10 on Ubuntu 20.04. We can do that by downloading Python from the source or using the deadsnakes custom PPA as follows.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># Update the system, ensuring the required packages are installed.
sudo apt update &amp;&amp; sudo apt upgrade -y # Install the required dependency needed to add the custom PPAs.
sudo apt install software-properties-common -y # Add the deadsnakes PPA to the list of APT package manager sources.
sudo add-apt-repository ppa:deadsnakes/ppa # Download Python 3.10
sudo apt install python3.10 # Confirm successful installation
python3.10 --version</pre>
<p>The next step is to locate pip.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># pip
pip --version
# OR
pip -V
pip list -v # pip3
pip3 -V
pip list -v</pre>
<p>Either way, you may get the following errors.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># pip
Command 'pip' not found, but can be installed with:
sudo apt install python3-pip # pip3
Command 'pip3' not found, but can be installed with:
sudo apt install python3-pip</pre>
<p>You get a similar error when you try installing a package.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># pip
pip install django
Command 'pip' not found, but can be installed with:
sudo apt install python3-pip # pip3
pip3 install django
Command 'pip3' not found, but can be installed with:
sudo apt install python3-pip</pre>
<p>Let’s install pip.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">sudo apt install python3-pip</pre>
<figure class="wp-block-image size-full is-style-default"><img loading="lazy" width="679" height="650" src="https://blog.finxter.com/wp-content/uploads/2022/04/pip-available.png" alt="" class="wp-image-302358" srcset="https://blog.finxter.com/wp-content/uploads/2022/04/pip-available.png 679w, https://blog.finxter.com/wp-content/uplo...00x287.png 300w" sizes="(max-width: 679px) 100vw, 679px" /></figure>
<h2>❒<strong>Solution 2: Add The Path Of Pip Installation To The PATH System Variable</strong></h2>
<p>You can use the terminal or the GUI.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">setx PATH "%PATH%;C:\Python&lt;version-subversion&gt;\Scripts" # For example
setx PATH "%PATH%;C:\Python310\Scripts" # for Python 3.10</pre>
<p>To use the GUI,</p>
<ol>
<li>copy to the full path of the system variable: <code>C:\&lt;username&gt;\steve\AppData\Local\Programs\Python\Python310\Scripts</code></li>
<li>Type <em>Edit the Environment Variables</em> on the search bar.</li>
<li>On the pop-up window, click on the <em>Advanced</em> tab followed by <em>Environment Variables</em>.</li>
</ol>
<figure class="wp-block-image size-full is-style-default"><img loading="lazy" width="608" height="702" src="https://blog.finxter.com/wp-content/uploads/2022/04/environment-variables.png" alt="" class="wp-image-302359" srcset="https://blog.finxter.com/wp-content/uploads/2022/04/environment-variables.png 608w, https://blog.finxter.com/wp-content/uplo...60x300.png 260w" sizes="(max-width: 608px) 100vw, 608px" /></figure>
<p>4. You are presented with two boxes. Highlight <em>path</em> on the first box followed by the <em>Edit</em> button below the box.</p>
<figure class="wp-block-image size-full is-style-default"><img loading="lazy" width="915" height="979" src="https://blog.finxter.com/wp-content/uploads/2022/04/path.png" alt="" class="wp-image-302360" srcset="https://blog.finxter.com/wp-content/uploads/2022/04/path.png 915w, https://blog.finxter.com/wp-content/uplo...80x300.png 280w, https://blog.finxter.com/wp-content/uplo...68x822.png 768w" sizes="(max-width: 915px) 100vw, 915px" /></figure>
<p>5. Click on <em>New</em>, paste the script path you had copied earlier, followed by <em>OK</em> on the bottommost part of the screen.</p>
<figure class="wp-block-image size-full is-style-default"><img loading="lazy" width="841" height="902" src="https://blog.finxter.com/wp-content/uploads/2022/04/save-path.png" alt="" class="wp-image-302361" srcset="https://blog.finxter.com/wp-content/uploads/2022/04/save-path.png 841w, https://blog.finxter.com/wp-content/uplo...80x300.png 280w, https://blog.finxter.com/wp-content/uplo...68x824.png 768w" sizes="(max-width: 841px) 100vw, 841px" /></figure>
<h2><strong>Conclusion</strong></h2>
<p>You have learned the leading causes of the error, “‘pip’ is not recognized as an internal or external command,” while installing packages and two typical ways to correct it.</p>
<p>You can check whether your installation was successful and whether the pip is updated and lies in the correct path. Otherwise, you can take the most appropriate step, as explained in this tutorial.</p>
<p>Please <strong><a rel="noreferrer noopener" href="https://blog.finxter.com/" target="_blank">stay tuned </a></strong>and <strong><a rel="noreferrer noopener" href="https://blog.finxter.com/subscribe/" target="_blank">subscribe</a> </strong>for more interesting discussions.</p>
</div>


https://www.sickgaming.net/blog/2022/04/...and-fixed/
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016