‘virtualenv’ is not recognized as an internal or external command, operable program or batch file

We’re attempting to utilize virtualenv for our project, but receiving the ‘virtualenv’ is not recognized as an internal or external command, operable program or batch file error. Here in this article, we will give you how to solve it. Let’s start!

How Does The Problem Happen?

The problem started when we tried virtualenv for our project. It looked like the following.

'virtualenv' is not recognized as an internal or external command, operable program or batch file.

Resolving The Error “‘virtualenv’ is not recognized as an internal or external command, operable program or batch file”

To resolve the error, all you have to do is reinstall virtualenv. Firstly, you must remove virtualenv using the pip remove virtualenv command. Then, try to reinstall it using pip set up virtualenv code. 

Another solution is to navigate the project directory to install virtualenv. On the command window, run python -m virtualenv after you have used run.scriptsactivate, and on cmd-prompt appears C:\Users\ssc\Desktop\MyProject>.

Put the name of the main file before the source location. You may now install any packages for the project exclusively in that folder.

The Solutions

Solution 1

All you have to do is reinstall virtualenv. Use the following command to remove virtualenv.

pip uninstall virtualenv
After that, try to reinstall virtualenv via the next command.
pip install virtualenv

Solution 2

To fix the problem, you should follow these steps.

  • Navigate to the project file where you wish to install virtualenv.
  • On the command window, execute python -m virtualenv
  • Execute \scripts\activate, and you may see on cmd-prompt the line C: UserssscDesktopMyProject>
  • Put the name of the main file before the source location. You may now add any packages into your project exclusively in the primary folder.

Conclusion

The ‘virtualenv’ is not recognized as an internal or external command, operable program or batch file is a fairly common problem that you’ll run into when working with Python. 

You’ll be working on a project and then try to use a command that you know works, but suddenly, it doesn’t work anymore. Our article is where you visit when you need a solution. Please add more ideas and solutions if you find any in the comment section. Thank you!


Related articles
Scroll to Top