-1

Could anyone please help me with how to fix the virtuaenv issue on windows 10 - 64-bit pc. I repeatedly keep getting this error while I try to create a virtual env using windows Powershell/Command windows to install Django projects

Error message "mkvirtualenv : The term 'mkvirtualenv' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

Appreciate your advice

Akbar
  • 1
  • 2
  • Does this answer your question? [Can't get virtualenvwrapper to work](https://stackoverflow.com/questions/31953682/cant-get-virtualenvwrapper-to-work) – phd Jan 19 '20 at 18:08
  • For Python 3, you may want to consider using a `venv` instead of `virtualenv`. `venv` does basically the same thing, but is packaged with Python 3 and doesn't rely on (admittedly elegant) hacks. https://docs.python.org/3/library/venv.html – FlipperPA Jan 20 '20 at 03:28

3 Answers3

3

First thing first, create a new folder or directory where you want to create your virtual environment. Once done locate that folder through CMD prompt.

Now, To create virtual environment in command prompt you first need to create a virtual environment wrapper first and with the help of that you can create virtual environment. Make sure you have python in your system before following below steps, type these commands one by one in your CMD prompt:

pip install virtualenvwrapper-win

mkvirtualenv name

note: in second code you can choose any name for your virtual environment

note: You will see something like this in your CMD prompt (name) C:\Users....

now install django in this virtual environment, just type the following command

pip install django

All done !

Extras (optional)

To check django version:

django-admin --version

(Type this command in your virtual environment only)

To work again on the same virtual environment:

workon name

( In place of enter the name of your virtual environment)

To stop virtual environment:

deactivate

( Yup, only this one code)

And then exit, happy coding :)

Yash Marmat
  • 1,077
  • 10
  • 18
1

The package which will provide "mkvirtualenv" has not been installed on your computer or your computer cannot locate where it is.
These packages below should be installed:

pip install virtualenv
pip install virtualenvwrapper-win
Poussy
  • 85
  • 4
0

i also got the same problem and this how i managed to overcome it

1- specify a directory/folder where you are to store the project using cmd ie for windows create a folder eg on desktop to store the project

C:\Users\zack>cd desktop

create a virtual environment folder on desktop using venv in the terminal

C:\Users\zack\Desktop>py -m venv django_project

activate the virtual environment using scripts\activate.bat

     C:\Users\zack\Desktop>django_project\scripts\activate.bat

you will see the virtual environment project on the desktop as shown below

 (django_project) C:\Users\zack\Desktop>

at the end a virtual environment folder is created on the desktop