Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • DSA
  • Practice Problems
  • C
  • C++
  • Java
  • Python
  • JavaScript
  • Data Science
  • Machine Learning
  • Courses
  • Linux
  • DevOps
  • SQL
  • Web Development
  • System Design
  • Aptitude
  • GfG Premium
Open In App
Next Article:
How to Install Virtual Environment in Python on MacOS?
Next article icon

How to Install Virtual Environment in Python on MacOS?

Last Updated : 29 Oct, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

In this article, we will learn how to install Virtual Environment in Python on macOS. The virtualenv is a tool to create isolated Python environments. Since Python 3.3, a subset of it has been integrated into the standard library under the venv module. The venv module does not offer all features of this library, to name just a few more prominent:

  • is slower (by not having the app-data seed method),
  • is not as extendable,
  • cannot create virtual environments for arbitrarily installed python versions (and automatically discover these),
  • is not upgrade-able via pip,
  • does not have a rich programmatic API (describe virtual environments without creating them).

Installation:

Method 1: Using pip to install virtual environment Package

Follow the below steps to install the virtual environment package on macOS using pip:

Step 1: Install the latest Python3 in MacOS

Step 2: Check if pip3 and python3 are correctly installed.

python3 --version  pip3 --version
checking python and pip version in macos

Step 3: Upgrade your pip to avoid errors during installation.

pip3 install --upgrade pip
upgrading pip in macos

Step 4: Enter the following command to install virtual environment using pip3.

pip3 install virtualenv
installing virtual environment package on macOS using pip

Method 2: Using setup.py to install virtual environment

Follow the below steps to install the virtual environment package on macOS using the setup.py file:

Step 1: Download the latest source package of virtual environment for python3 from here.

curl https://files.pythonhosted.org/packages/dd/40/9bc1b32521f78c293c1f8ca423c725737dfa9d09640dbeec61cebca7c5f2/virtualenv-20.8.1.tar.gz > virtualenv.tar.gz
downloading the source package for virtual environment in macos

Step 2: Extract the downloaded package using the following command.

tar -xzvf virtualenv.tar.gz
extracting the virtualenv.tar.gz file in macos

Step 3: Go inside the folder and Enter the following command to install the package.

Note: You must have developer tools for XCode MacOS installed in your system

cd virtualenv-20.8.1  python3 setup.py install
installing virtual environment on macOS using the setup.py file

Verifying virtual environment installation on macOS:

Make the following import in your python terminal to verify if the installation has been done properly:

import virtualenv
Verifying virtual environment installation on macOS

If there is any error while importing the module then is not installed properly.


Next Article
How to Install Virtual Environment in Python on MacOS?

A

anilabhadatta
Improve
Article Tags :
  • How To
  • Installation Guide
  • how-to-install

Similar Reads

    How to Install Turtle in Python on MacOS?
    Turtle is a Library of Python Language. Turtle graphics is the best way to introduce programming to kids. We can design pictures and create shapes on a virtual canvas provided by a turtle. Installing the Turtle Package on MacOS using PIP To install Turtle Package on MacOS follow these steps: Step 1:
    1 min read
    How to Install Eli5 in Python on MacOS?
    Eli5 is an open-source library that is written purely in Python for easy and quick debugging of machine learning classifiers and interpreting their predictions. It provides support for machine learning frameworks and packages such as sci-kit-learn, Keras, xgboost, etc. The Eli5 library is a cross-pl
    2 min read
    How to Install Gekko in Python on MacOS?
    In this article, we will learn how to install Gekko in Python on MacOS. GEKKO is a python package for machine learning and optimization, specializing in dynamic optimization of differential-algebraic equations (DAE) systems. Installation:Method 1: Using pip to install Gekko Package Follow the below
    2 min read
    How to Install glob in Python on MacOS?
    In this article, we will learn how to install glob in Python on MacOS. Glob is a general term used to define techniques to match specified patterns according to rules related to Unix shell. Linux and Unix systems and shells also support glob and also provide function glob() in system libraries. Inst
    2 min read
    How to Install GIT on Python Virtualenv?
    A Virtual Environment is a mechanism that can be compared with a separating funnel, when we are creating or using different projects which require different types of packages and modules we will create a virtual environment for each of them so that the packages/modules we install for say project A d
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences