- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Creating Python Virtual Environment in Windows and Linux
Virtual Environment is used to manage our Python projects more efficiently. Every project has a dedicated environment for better results and future updates. For example, we have a project which uses Django2.1 and another one that uses Django2.2. Now, in these types of cases, we can make use of virtual environments to both projects individually without any problem. In this tutorial, we are going to see how to work with the virtual environment. We need to install virtualenv. Run the following command to see whether virtualenv is installed on your computer or not.
virtualenv --version
If you run the above command, you will see the following(maybe different version) output.
16.7.4
If you didn't see the version of the virtualenv then, it's not installed on your computer. Run the following command to install it on your PC.
pip install virtualenv
Now, we are ready to create our virtual environments. Follow the below steps one by one to create a virtual environment.
Virtual Environment
Command to initialize the project with virtualenv.
virtualenv project_name
If you run the above command, you will get a folder with the name you mentioned.
Command to activate the virtualenv.
source project_name/bin/activate
Now, you are in a virtual environment. Python defaults install the latest version of it in the virtualenv.
Command to deactivate.
deactivate
Conclusion
If you have any doubts regarding the tutorial, mention them in the comment section.
- Related Articles
- Python Virtual Environment
- How to create a virtual environment in Python?
- How to set python environment variable PYTHONPATH on Windows?
- Difference between Linux and Windows
- Merits and Demerits of VMware vSphere hosted Virtual Environment
- Managing Environment Variables in Linux
- Locale Environment Variables in Linux
- How to set Python environment variable PYTHONPATH on Linux?
- How to configuring Java Environment on Windows?
- How to install JDK in Windows and set up the environment variables?
- Difference Between Linux and Windows Operating System
- Best Syslog Servers for Linux and Windows
- What are the process states in Windows and Linux?
- Creating virtual tables from remote source in SAP HANA
- Creating a Temporary File in Linux
