'pip' is not recognized as an internal or external command
To fix the pip not recognized
issue, you need to add the pip
executable's path to your PATH
environment variable. Follow these steps for Windows:
- Locate your Python
Scripts
path (C:\Python39\Scripts
for instance). - Press Win + R, type
sysdm.cpl
, hit Enter. - Navigate to Advanced > Environment Variables.
- Under System variables, edit the Path.
- Click New and paste the
Scripts
path. - Apply changes, don't forget to restart your command line!
Then finally:
If pip
shows its version, it means it's now in the PATH
!
Just tripping over a pitfall?
Sometimes it's a simple misstep causing the pip not recognized
issue. Here are some common ones:
An identity crisis: Python 2.x or 3.x?
If you have both Python 2.x and Python 3.x installed, the correct Scripts
folder should be in the PATH
. If the pip
command isn't recognized, you may be trying Python 2.x pip
with Python 3.x and vice versa. Keep them straight!
Did you refresh the shell?
This is akin to "Have you tried turning it off and on again?" After running setx
to update the PATH
, you need to start a fresh command shell. Try this:
Remember, much like how refreshing a webpage gives updates, restarting your shell lets you pip
away!
Quick spots fix with full paths
Temporary workarounds may get you moving. You can invoke pip
with its full path:
Yes, it's a bit longer, but gets the job done!
Diving deeper into the configuration
If the simple fixes don't work, don't worry. We can get our hands a bit more dirty:
Working in a bubble with Virtual Environments
Virtual environments encapsulate dependencies, giving you a 'personal bubble' to work in. Once you activate the environment, pip
should work if the PATH
is set correctly within it, offering a safe and relaxed coding environment.
Upgrading to boss level: Administrator rights
Sometimes, even making changes to environment variables requires boss level rights, i.e., running CMD as administrator. This is especially true when using setx
. So be the boss and wield the setx
command like a boss!
The nuclear option: Reinstall it all
If everything else fails, resort to the scorched earth policy: reinstall Python and pip. During installation, ensure you tick the box that says "Add Python to PATH" this time to avoid going nuclear again!
Ensuring pip access consistently
Ensuring that pip
is consistently accessible is crucial. Here are a few tricks to ensure that:
Is the PATH traveled, the right one?
Checking your PATH is crucial when troubleshooting pip issues. A simple echo %PATH%
can reveal which paths are recognised by your system.
Should I call you pip or pip3?
Python is a well-mannered language and it differentiates between its versions. If you're using Python 3.x, it's polite to use pip3
instead of pip
. Python appreciates good manners!
Thank you, Scott, you're a legend!
Scott Bartell's advice of using setx
to handle PATH
issues have been a life-saver for many. On behalf of the whole Python community, thanks for being awesome, Scott!
Keep in touch with the Official Docs
The official installation guide from the Python Packaging Authority (PyPA) is a goldmine. It should be your first line of defense against any pip problems.
Knowledge is power, keep learning
Stay ahead of the curve by having the latest pip version. Use pip install --upgrade pip
regularly and be part of Python forums to learn more.
Was this article helpful?