开发环境的配置

来源:互联网 发布:教学实训软件 编辑:程序博客网 时间:2024/04/30 21:45

由于总是在环境配置上浪费时间,写这篇文章备份一下下次遇到同样的问题不用再去网上一点一点的查找。

ubuntu安装scikit-learn

按照scikit-learn的文档说明,scikit-learn要求的环境为

Python (>= 2.7 or >= 3.3)NumPy (>= 1.6.1)SciPy (>= 0.9)

在ubuntu上安装很好实现。输入命令

sudo apt-get install build-essential python-dev python-numpy python-setuptools python-scipy libatlas-dev  

python-matplotlib可以进行画图

sudo apt-get install python-matplotlib 

输入命令安装scikit-learn

pip install -U scikit-learn

或者

easy_install -U scikit-learn

这里需要翻墙,国内的网络比较慢。

mongodb在ubuntu的配置

mongo安装方式有两种,第一种是下载安装包安装,第二种直接使用apt-get install方法安装。我觉得第二种方法比较简单。

sudo apt-get install mongodb

查看mongo版本

mongo -version

进入mongodb shell

leiline@leiline-virtual-machine:~$ mongoMongoDB shell version: 2.4.9connecting to: testServer has startup warnings: Thu Feb  2 10:50:05.627 [initandlisten] Thu Feb  2 10:50:05.627 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.Thu Feb  2 10:50:05.627 [initandlisten] **       32 bit builds are limited to less than 2GB of data (or less with --journal).Thu Feb  2 10:50:05.627 [initandlisten] **       See http://dochub.mongodb.org/core/32bitThu Feb  2 10:50:05.648 [initandlisten] 
show dbs

显示数据库列表

show collections

显示当前数据库中的集合(类似关系数据库中的表table)

show users

显示所有用户

use yourDB

切换当前数据库至yourDB

db.help() 

显示数据库操作命令

db.yourCollection.help() 

显示集合操作命令,yourCollection是集合名

1、MongoDB没有创建数据库的命令,如果你想创建一个“School”的数据库,先运行use School命令,之后做一些操作(如:创建聚集集合db.createCollection(‘teacher’)),这样就可以创建一个名叫“School”的数据库。

2、插入数据右两种方式:insert和save

db.student.insert({_id:1, sname: 'zhangsan', sage: 20}) #_id可选db.student.save({_id:1, sname: 'zhangsan', sage: 22}) #_id可选

3、查找数据
db.youCollection.find(criteria, filterDisplay)
criteria :查询条件,可选
filterDisplay:筛选显示部分数据,如显示指定列数据,可选(当选择时,第一个参数不可省略,若查询条件为空,可用{}做占位符,如下例第三句)

db.student.find()  #查询所有记录。相当于:select * from studentdb.student.find({sname: 'lisi'})  #查询sname='lisi'的记录。相当于: select * from student where sname='lisi'db.student.find({},{sname:1, sage:1}) #查询指定列sname、sage数据。相当于:select sname,sage from student。sname:1表示返回sname列,默认_id字段也是返回的,可以添加_id:0(意为不返回_id)写成{sname: 1, sage: 1,_id:0},就不会返回默认的_id字段了db.student.find({sname: 'zhangsan', sage: 22}) #and 与条件查询。相当于:select * from student where sname = 'zhangsan' and sage = 22db.student.find({$or: [{sage: 22}, {sage: 25}]}) #or 条件查询。相当于:select * from student where sage = 22 or sage = 25

4、修改数据
db.youCollection.update(criteria, objNew, upsert, multi )
criteria: update的查询条件,类似sql update查询内where后面的
objNew : update的对象和一些更新的操作符(如$set)等,也可以理解为sql update查询内set后面的。
upsert : 如果不存在update的记录,是否插入objNew,true为插入,默认是false,不插入。
multi: mongodb默认是false,只更新找到的第一条记录,如果这个参数为true,就把按条件查出来多条记录全部更新。默认false,只修改匹配到的第一条数据。
其中criteria和objNew是必选参数,upsert和multi可选参数

db.student.update({sname: 'lisi'}, {$set: {sage: 30}}, false, true) #相当于:update student set sage =30 where sname = 'lisi';

5、删除数据

db.student.remove({sname: 'chenliu'}) #相当于:delete from student where sname='chenliu'

6、退出shell命令模式
输入exit或者Ctrl+C退出shell命令模式

Xshell连接linux报错

这里写图片描述
这个时候需要修改

sudo vim /etc/ssh/sshd_config

PermitRootLogin prohibit-password

改为

PermitRootLogin yes

主机重新启动,连接就可以了。

0 0