Reputation: 1
I wish to use Django to create a Web app, but first I need to create an virtual environment.
Since I have a Windows system, I have used Win+R and cmd to open the teriminal, then the system shows C:\Users\HP>, I tried to create a datalog named learning_log and use terminal to switch to this datalog, so I typed in learning_log$ python -m venv 11_env, but the system shows 'learning_log$' is not recognized as an internal or external command, operable program or batch file.
May I know how to create a datalog and how to create an virtual working environment?
Upvotes: 0
Views: 78
Reputation: 55
First you need to install virtualenv library:
pip3 install virtualenv
After installing virtualenv, now create virtual environment directory with any name:
virtualenv myvenv
Now you can see, myvenv folder. now you can activate the virtual environment using that folder location:
.\myvenv\Scripts\activate.bat
Now you can see the virtual environment activated and you can see (myvenv) on your command prompt.
Upvotes: 0
Reputation: 604
It's unclear to me why you need a 'datalog' to create a Django web app, so I'll just help out with the VENV side of things.
To create a virtual environment in Python:
A full guide to getting started with a virtual environment in Django can be found here.
Open the current directory in a terminal. The easiest way to do this is probably open command prompt like you did.
Win Key + R
-> cmd
Then copy the directory to your current folder from the top of File Explorer e.g. C:\Users\user_name\Documents\test_venv
Then paste this into the terminal like so
python -m venv "C:\Users\user_name\Documents\test_venv"
This will create a virtual environment at that directory. Now navigate to that directory using terminal cd "C:\Users\user_name\Documents\test_venv"
and you can perform your next actions.
It's easiest to do this if you have an IDE and can just set it up to load a terminal in your current directory. Then you don't need to navigate to it and can just create the virtual environment at the current directory.
Upvotes: 1