I am unable to create a virtualenv in command window to run django projects

Deadly 提交于 2020-05-24 07:35:07

问题


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


回答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



回答2:


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 :)



来源:https://stackoverflow.com/questions/59812865/i-am-unable-to-create-a-virtualenv-in-command-window-to-run-django-projects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!