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

PythonPython 2.7Virtualenv

Python Problem Overview


After I installed Python and Djangom, I'm trying to use virtualenv for django project purpose using virtualenv. I installed virtualenv using pip.

pip install virtualenv # got install successfully

When I tried to run it, I got the error message

C:\Users\gshiv\Desktop\DjangoProject>virtualenv
'virtualenv' is not recognized as an internal or external command,
operable program or batch file.

Python Solutions


Solution 1 - Python

steps:

  • go to where you want create django app on that folder.

then run this command on command prompt : python -m virtualenv .

(eg. C:\Users\gshiv\Desktop\django>python -m virtualenv .)

where django is the my folder i want run virtualenv and .(dot) indicates virtualenv install all it's folder in django folder otherwise you can use other folder name instead .(dot) this time virtulenv creates a folder in main folder(django) .

  • after running this command: run .\scripts\activate now you can see this type of line on cmd-prompt (django) C:\Users\gshiv\Desktop\django>
  • i.e main folder name before the source path. now you can install any modules for your project that belongs to that main folder only.

pip install django works fine.

Solution 2 - Python

Run pip uninstall virtualenv and then pip install virtualenv

Solution 3 - Python

If you can not find your 'virtualenv' command in the windows console after installing it with pip try this to make your environment:

python -m virtualenv <nameOfEnv>

If you need to use a specific version of python, initialize it like this:

python -m virtualenv <nameOfEnv> -p=<C:/path/to/python/version3.x.x/python.exe>

When using windows for first installation, you can use python from WindowsApp

Solution 4 - Python

There are three points that you need to consider:

  • Make sure that in the windows PATH variable there is an entry with your python installation and the scripts subfolder eg: C:\Program Files (x86)\Python36-32\ and C:\Program Files (x86)\Python36-32\Scripts\
  • When using pip install virtualenv, make sure that you run cmd as administrator. Otherwise, there might an access denied error during installation and virtualenv will not be installed properly.
  • Make sure that virtualenv has been installed correctly. Check in the python scripts subfolder - there must exist an .exe named virtualenv.exe. If not, uninstall will pip uninstall virtualenv and install again.

Solution 5 - Python

When I ran the pip install virtualenv command I got:

Requirement already satisfied: virtualenv in c:\directory\to\appdata\roaming\python\python36\site-packages

so I tried forcing upgrade:

pip install --upgrade --force virtualenv

Solution 6 - Python

py -3 -m venv venv

try using the above command.

virtualenv venv

will work on only older version of python

Solution 7 - Python

Use

python -m venv abc

Where abc is the name of the virtual environment

Solution 8 - Python

Run CMD as administrator and then enter

pip uninstall virtualenv

then re-run CMD as administrator and run

pip install virtualenv

Solution 9 - Python

To install to a specific folder e.g E:\publish

pip install virtualenv

virtualenv .

Solution 10 - Python

Use "py -m virtualenv Your_Folder_Name"

Solution 11 - Python

Try to run

    PowerShell.exe -command "./venv/Scripts/activate"

Solution 12 - Python

Try executing virtualenv.exe from its absolute path, like in my case i found it in C:\Users\<your user>\AppData\Roaming\Python\Python37\Scripts\virtualenv.exe.

I tried this and it worked, here refer the logs as follows:

Using base prefix c:\\users\\<user>\\appdata\\local\\programs\\python\\python37-32 New python executable in C:\somedir\dir2\dir3\ML_1\ml\env\Scripts\python.exe Installing setuptools, pip, wheel... done.

Solution 13 - Python

For windows First, install -> pip install virtualenvwrapper-win Then setup -> mkvirtualenv myproject Then you see the list of virtual environment To see it you write-> lsvirtualenv For working this environment we write -> workon myproject

Solution 14 - Python

This almost works for all

  1. Open Command Prompt, navigate it to the Envs folder, run "env_name\Scripts\activate"
  2. Check whether virtualenv is installed or not, if not install it:
    • pip install virtualenv
    • pip install virtualenvwrapper-win
  3. Game On. Check on your IDE.

Solution 15 - Python

1)First Way as

python -m virtualenv name_of_virtual_environment


OR


2)Second Way as

py -3 -m venv name_of_virtual_environment

Solution 16 - Python

I got this error too but I figure it out. you just have to open PowerShell as administrator and then write following command Set-ExecutionPolicy unrestricted then type A. you are all set! now uninstall the packages and re-install them. Now if you write flask --version or virtualenv --version There will be no error at all.

Solution 17 - Python

Make sure that virtualenv has been installed correctly. Check in the python scripts subfolder - there must exist an .exe named virtualenv.exe. If not, uninstall will pip uninstall virtualenv and install again.

Solution 18 - Python

  1. Open a cmd or ps with run as admin.
  2. Now run pip uninstall virtual.
  3. pip install virtual.
  4. Done :D

Implementation:

  1. Go to the directory where you want to make a python env.
  2. type: virtualenv myEnv
  3. beep bop boop done.

ps: Always use cmd or powershell with run as admin if you're installing some new package.

Solution 19 - Python

Insted of using virtualenv <file name>

use :

> py -3 -m venv

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionShivaGuntukuView Question on Stackoverflow
Solution 1 - PythonShivaGuntukuView Answer on Stackoverflow
Solution 2 - PythonSergey K.View Answer on Stackoverflow
Solution 3 - PythonTirbo06View Answer on Stackoverflow
Solution 4 - PythonCharidimosView Answer on Stackoverflow
Solution 5 - PythonhestellezgView Answer on Stackoverflow
Solution 6 - Pythonpraveen kumarView Answer on Stackoverflow
Solution 7 - PythonZubair BalochView Answer on Stackoverflow
Solution 8 - PythonFirenzeView Answer on Stackoverflow
Solution 9 - PythonMANOJ GView Answer on Stackoverflow
Solution 10 - PythonMohammad m. TaheriView Answer on Stackoverflow
Solution 11 - PythonResistorsSmokerView Answer on Stackoverflow
Solution 12 - PythonVishal GargView Answer on Stackoverflow
Solution 13 - PythonShahadat HossainView Answer on Stackoverflow
Solution 14 - PythonRam PotabattiView Answer on Stackoverflow
Solution 15 - Pythonmrcaption49View Answer on Stackoverflow
Solution 16 - PythonBalaji guptaView Answer on Stackoverflow
Solution 17 - Pythonsri_nandhanView Answer on Stackoverflow
Solution 18 - PythonThe FlashView Answer on Stackoverflow
Solution 19 - PythonQerqieView Answer on Stackoverflow