博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
设置MongoDB课程环境
阅读量:5879 次
发布时间:2019-06-19

本文共 3358 字,大约阅读时间需要 11 分钟。

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.

  • Installed MongoDB on , , or .

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  to install Python 3 and to manage our Python environment. You can download Anaconda from their . 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  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!

转载于:https://www.cnblogs.com/huahuayu/p/8414208.html

你可能感兴趣的文章
/proc/filesystems各字段含义
查看>>
Fabric密码保存
查看>>
guice基本使用,三种注入方式(二)
查看>>
Android Weekly Notes Issue #235
查看>>
ssh 连接缓慢解决方法
查看>>
【转】Hibernate系列学习之(二) 多对一、一对一、一对多、多对多的配置方法...
查看>>
杭电OJ(HDU)-ACMSteps-Chapter Three-《FatMouse' Trade》《今年暑假不AC》《排名》《开门人和关门人》...
查看>>
关于javaSocket中 Software caused connection abort: recv failed问题
查看>>
【翻译自mos文章】当并行事务恢复进程在执行时,禁用并行事务恢复的方法
查看>>
VUE -- 如何快速的写出一个Vue的icon组件?
查看>>
31.Node.js 常用工具 util
查看>>
服务器的svnserver修改密码
查看>>
利用 fdisk进行分区
查看>>
WPF 实现窗体拖动
查看>>
来自维基百科程序员Brandon Harris
查看>>
NULL不是数值
查看>>
CentOS 5 全功能WWW服务器搭建全教程
查看>>
30个优秀的后台管理界面设计案例分享
查看>>
scala111
查看>>
模块化服务规范——OSGI
查看>>