Download and Install
Note
Alternative Installation Methods
The following guide shows you how to install PyMongo by using pip. To install PyMongo from source, see Install from Source in the API Documentation.
Create a Project Directory
In your shell, run the following command to create a
directory called pymongo-quickstart
for this project:
mkdir pymongo-quickstart
Select the tab corresponding to your operating system and run the following commands
to create a quickstart.py
application file in the pymongo-quickstart
directory:
cd pymongo-quickstart touch quickstart.py
cd pymongo-quickstart type nul > quickstart.py
Install PyMongo
Select the tab corresponding to your operating system and run the following commands to create and activate a virtual environment in which to install the driver:
python3 -m venv venv source venv/bin/activate
python3 -m venv venv . venv\Scripts\activate
With the virtual environment activated, run the following command to install the current version of PyMongo:
python3 -m pip install pymongo
After you complete these steps, you have a new project directory and the driver dependencies installed.
Note
If you run into issues on this step, ask for help in the MongoDB Community Forums or submit feedback by using the Rate this page tab on the right or bottom right side of this page.