ubuntu的工作环境搭建【数据挖掘简易环境】

来源:互联网 发布:电子商城源码 编辑:程序博客网 时间:2024/06/05 10:47

1、先装vim编辑器

sudo apt-get install vim

2、更新为清华源

在国内下载软件速度较慢,可以将源更换为清华镜像源,或者阿里,或者其他的。速度会有明显的提示

sudo vim /etc/apt/sources.list  

然后将

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse# 预发布软件源,不建议启用# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

粘贴在sources.list

sudo apt-get update  # 更新源

3、下载、安装、配置Anaconda

我下载的是python 2.7 64位的

wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda2-4.4.0-Linux-x86_64.sh# 安装anacondabash Anaconda2-4.4.0-Linux-x86_64.sh# 添加anaconda 进环境变量vim /home/xusenlan/.bashrc

这里写图片描述

export PATH=/home/xusenlan/anaconda2/bin:$PATH添加到.bashrc的最后一行。注意你的路径和我的不一样

这里写图片描述

安装好之后python是anaconda的版本

4、配置jupyter notebook远程登录

4.1 生成配置文件

$jupyter notebook --generate-config

4.2 生成密码

打开ipython, 创建一个密码, 并把生成的密文sha:ce...复制下来,待会儿会用到

In [1]: from notebook.auth import passwdIn [2]: passwd()Enter password: Verify password: Out[2]: 'sha1:ce.....'

4.3 修改默认配置文件

$vim ~/.jupyter/jupyter_notebook_config.py

进行下列修改:

c.NotebookApp.ip='*'c.NotebookApp.password = u'sha:ce...刚才复制的那个密文'c.NotebookApp.open_browser = Falsec.NotebookApp.port =8777 #随便指定一个端口

4.4 建立ssh通道

需要xshell,当然你也可以用其他的远程工具。

这里写图片描述
目标主机是你服务器的ip地址

4.5 打开jupyter notebook

# 在终端输入, 一直启动notebook[nohup]nohup jupyter notebook &# 在win的浏览器中 输入[你的ip地址]:端口号# 之后输入你4.2步的密码就行了

5、更改pip源和anaconda源

mkdir ~/.pipvim ~/.pip/pip.conf# 在pip.conf中添加[global]timeout=40index-url= http://pypi.douban.com/simple/[install]trusted-host=    pypi.douban.com