設定MongoDB課程環境

來源:互聯網
上載者:User

標籤:resource   pen   ade   cluster   ike   intro   sum   doc   get   

Setting Up Your Course Environment

This course is designed to be very hands on. Virtually all of the lectures have resources that can be downloaded so that you can follow along with the instructor. These resources are listed below the lecture video underneath "Downloads".

Prerequisites

Before following the instructions below you should make sure you‘ve completed the following prerequisites.

  • Created an Atlas Free-Tier Cluster
  • Installed MongoDB on Windows, OSX, or Linux.
Course Directory Structure

You‘ll likely be downloading many files as you progress through the course. To keep all of these files organized we suggest you create a folder structure like so:

.└── mongodb-analytics    └── intro-to-mongodb        ├── mflix        └── notebooks
 

The "mongodb-analytics" folder is used to segment the different courses in this specialization. So you can create a folder inside of that called "intro-to-mongodb" for this course‘s downloadable resources. The notebooks folder is for all of the notebooks and datasets that you download. And finally, there‘s the the mflix folder which will hold the mflix app that you‘ll download and install later in the course.

Jupyter Notebooks

Many of the resources you download will be Jupyter notebooks that you can run locally on your computer. The following sections will walk you through how to install and set up your Juyter notebook environment.

We‘re going to use Anacanoda to install Python 3 and to manage our Python environment. You can download Anaconda from their download site. After downloading the installer you can run it to install Python 3 and Anaconda‘s commandline tools.

You‘ll want to create an Anaconda environment for all your Python dependancies. Run this command from inside the intro-to-mongodb folder.

conda create -n intro-to-mongodb

 

You can then activate this environment by running:

source activate intro-to-mongodb # on Linux and macOSactivate intro-to-mongodb # on Windows

 

Then from inside your notebooks directory you can run the following command to start your Jupyter notebook:

jupyter notebook

 

From there, you should be able to point your browser to http://localhost:8888/ to access the Jupyter Notebook interface. Now, any notebooks (ipynb files) that you place in the notebooks directory will appear and be executable in this interface.

Installing Python Dependancies

You now have an environment set up where you can execute the handouts from the lectures and assessments. Some of the notebooks that you‘ll download will use 3rd party Python modules. A great example of this is pymongo, which is the Python module that allows your scripts to talk to a MongoDB database.

To install 3rd party Python modules you‘ll use the pip command, which is installed alongside Python via Anaconda. By default, pip installs Python modules globally. To prevent polluting your global Python environment you‘ll want to install all the modules used in this course inside your Anaconda environment.

For example, if you wanted to install pymongo you‘d do something like the following:

# This assumes your mongodb-analytics folder is stored in your home directorycd ~/mongodb-analytics/intro-to-mongodbsource activate intro-to-mongodb # on macOS and Linuxactivate intro-to-mongodb # on Windowspip install pymongo dnspython
 

After executing the following commands you‘ll be able to use the pymongo module to connect your Jupyter notebooks to MongoDB!

設定MongoDB課程環境

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.