So am working in a group project, we are using python and of the code is on GitHub. My question is how do I activate the virtual environment? Do I make one on my own using the "python virtual -m venv env" or the one that's on the repo, if there is such a thing. Thanks
virtual env is used to make your original env clean. you can pip install virtualenv
and then create a virtual env like virtualenv /path/to/folder
then use source /path/to/folder/bin/activate
to activate the env. then you can do pip install -r requirements.txt
to install dependencies into the env. then everything will be installed into /path/to/folder/lib
alteratively, you can use /path/to/folder/bin/pip install
or /path/to/folder/bin/python
without activating the env.
Yes, you'll want to create your own with something like: python -m venv venv
. The final argument specifies where your environment will live; you could put it anywhere you like. I often have a venv
folder in Python projects, and just .gitignore it.
After you have the environment, you can activate it. On Linux: source venv/bin/activate
. Once activated, any packages you install will go into it; you can run pip install -r requirements.txt
for instance.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.