Last updated: Apr 4, 2024
Reading timeยท4 min
The error "'pipenv' is not recognized as an internal or external command,
operable program or batch file" occurs when we forget to install pipenv
before
running the command.
To solve the error, install the pipenv
package by running the
pip install pipenv
command.
Make sure you have pipenv
installed by running the following command in cmd
.
pip install pipenv # ๐๏ธ for Python 3 pip3 install pipenv # ๐๏ธ If you don't have pip in your PATH environment variable python -m pip install pipenv # ๐๏ธ using py alias py -m pip install pipenv # ๐๏ธ for Python 3 python3 -m pip install pipenv # ๐๏ธ If you get a permissions error pip install pipenv --user
You should now be able to use the pipenv
command as follows.
pipenv --help pipenv --version python -m pipenv --help python -m pipenv --version py -m pipenv --help py -m pipenv --version
If the installation command doesn't succeed, try running CMD as an administrator.
To open CMD as an administrator:
Click on the Search bar and type CMD.
Right-click on the Command Prompt application and click "Run as administrator".
If you get the error
"'pip' is not recognized as an internal or external command",
use the python -m
command when installing pipenv
.
# ๐๏ธ first uninstall `virtualenv` and `pipenv` python -m pip uninstall virtualenv pipenv -y py -m pip uninstall virtualenv pipenv -y python3 -m pip uninstall virtualenv pipenv -y # ๐๏ธ now install `pipenv` python -m pip install pipenv py -m pip install pipenv python3 -m pip install pipenv
You can also try to upgrade the package with the --upgrade
option.
python -m pip install pipenv --upgrade py -m pip install pipenv --upgrade python3 -m pip install pipenv --upgrade
If you see an error message that "ps1 cannot be loaded because running scripts is disabled on this system", run the following command, type "yes" when prompted and rerun the activation command.
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
pipenv
module is installed by using the pip show pipenv
command.pip show pipenv pip3 show pipenv python -m pip show pipenv py -m pip show pipenv python3 -m pip show pipenv
The pip show pipenv
command will either state that the package is not
installed or show a bunch of information about the package, including the
location where the package is installed.
If the error persists, you have to add Python to your user's PATH environment variable.
To add Python to your user's PATH environment variable:
python -c "import os, sys; print(os.path.dirname(sys.executable))" where python
For me, the path is the following.
C:\Users\YOUR_USER\AppData\Local\Programs\Python\Python310
Note that I have Python 3.10 installed, which is reflected in the PATH.
Scripts
directory that
is located in your Python3X folder. This is where the executable files are
located.For me, it is the following path.
C:\Users\YOUR_USER\AppData\Local\Programs\Python\Python310\Scripts
You might also have to restart your PC, but that's not always necessary.
If you still encounter issues, try to add Python to your PATH using the official installer.
Download the installer from the official python.org website.
If you have Python already installed, start the installer and click on "Modify".
You can leave the optional features ticked.
If that didn't work, your Python installation might be corrupted.
Start the installer again and click on "Uninstall".
Now that you don't have Python installed on your machine, start the installer again and make sure to tick the "Add python.exe to PATH" option.
The checkbox won't be checked by default.
Once the "Add python.exe to PATH" checkbox is checked, click on "Install Now".
After the installation, Python will be installed and configured properly.
You can learn more about the related topics by checking out the following tutorials: