环境: Debian 8.8 64位, 同样适用 win10

基本步骤:

  1. 安装 Python
  2. 安装必要的库
  3. 测试

一、安装 Python

延续之前的 搭建 Python 环境 选取折中版本 Python 3.4

sudo apt-get install python3

这个时候会遇到一个问题:同时装了Python3和Python2,怎么用pip?默认安装的 pip 对应的是 python 2.7

选用最 简单直接的方案:

apt-get purge -y python3-pip
apt-get install python3-pip

检查有没有安装好:

root@xkfx:/opt/python# python3 -m pip -V
pip 1.5. from /usr/lib/python3/dist-packages (python 3.4)

更新到最新版本:

python3 -m pip install --upgrade pip  

用 pip 安装模块到对应 Python 版本的方法(指明 Python 版本):

python3 -m pip install 模块名

PS. -m 大概是 module模块的意思

二、安装必要的库

ipython:

root@xkfx:~# python3 -m pip install ipython

root@xkfx:/opt/python# ipython
Python 3.4. (default, Oct , ::)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.3. -- An enhanced Interactive Python. Type '?' for help. In []: exit

matplotlib:

root@xkfx:~# python3 -m pip install matplotlib

root@xkfx:~# python3
Python 3.4. (default, Oct , ::)
[GCC 4.9.] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xxxxxx
Traceback (most recent call last):
File "<stdin>", line , in <module>
ImportError: No module named 'xxxxxx'
>>> import matplotlib

numpy:

root@xkfx:~# python3 -m pip install numpy
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Requirement already satisfied: numpy in /usr/local/lib/python3./dist-packages (1.14.)
root@xkfx:~# python3
Python 3.4. (default, Oct , ::)
[GCC 4.9.] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy

sklearn:

root@xkfx:~# python3 -m pip install scipy

root@xkfx:~# python3 -m pip install sklearn

root@xkfx:~# python3
Python 3.4. (default, Oct , ::)
[GCC 4.9.] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sklearn

tensorflow:

root@xkfx:~# python3 -m pip install tensorflow

root@xkfx:~# python3
Python 3.4. (default, Oct , ::)
[GCC 4.9.] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> print(tf.__version__)
1.7.

pandas:

python3 -m pip install pandas 

 Command "/usr/bin/python3 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-kfazvlty http://mirrors.aliyun.com/pypi/packages/1b/d2/22cde5ea9af055f81814f9f2545f5ed8a053eb749c08d186b369959189a8/wheel-0.31.0-py2.py3-none-any.whl#md5=240d714477a715bcd90e94cb2c44f28c http://mirrors.aliyun.com/pypi/packages/20/d7/04a0b689d3035143e2ff288f4b9ee4bf6ed80585cc121c90bfd85a1a8c2e/setuptools-39.0.1-py2.py3-none-any.whl#md5=ca299c7acd13a72e1171a3697f2b99bc http://mirrors.aliyun.com/pypi/packages/70/25/1e1521e6ce2cf78ff4a8b06fbc2cd513ce004ec337000eddfe016fdf3fc6/Cython-0.28.2-cp34-cp34m-manylinux1_x86_64.whl#md5=e277ba5fdbbaab6e3434bdcf58e41d6a http://mirrors.aliyun.com/pypi/packages/fc/1b/a1717502572587c724858862fd9b98a66105f3a3443225bda9a1bd16ee14/numpy-1.9.3-cp34-cp34m-manylinux1_x86_64.whl#md5=e1130c8f540a759d79ba5e8960f6915a http://mirrors.aliyun.com/pypi/packages/02/64/c6c1c24ff4dbcd789fcfdb782e343ac23c074f6b8b03e818ff60eb0f937f/numpy-1.12.1-cp34-cp34m-manylinux1_x86_64.whl#md5=6288d4e9cfea859e03dc82879539d029 http://mirrors.aliyun.com/pypi/packages/1b/ee/f65826b2880f67652c21326565b4c166c7cdb1019f84b82af65e625475cd/numpy-1.13.1-cp34-cp34m-manylinux1_x86_64.whl#md5=c51520d0d3836c91cba18d1fa8cf299c" failed with error code  in None

由于在 debian 下无论如何都没有成功安装 pandas

我最后决定在 windows  上搭建环境。。。

三、测试

把下面这段代码运行一下,没有报错基本就 ok 了。

import math

from IPython import display
from matplotlib import cm
from matplotlib import gridspec
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
from sklearn import metrics
import tensorflow as tf
from tensorflow.python.data import Dataset tf.logging.set_verbosity(tf.logging.ERROR)
pd.options.display.max_rows =
pd.options.display.float_format = '{:.1f}'.format

Linux笔记 #07# 搭建机器学习环境的更多相关文章

  1. Linux 笔记 #01# 搭建 Python 环境 & vim 代码高亮

    日常收集 vim editor: How do I enable and disable vim syntax highlighting? 搭建 Python 环境 vim editor: How d ...

  2. Hadoop学习笔记(4) ——搭建开发环境及编写Hello World

    Hadoop学习笔记(4) ——搭建开发环境及编写Hello World 整个Hadoop是基于Java开发的,所以要开发Hadoop相应的程序就得用JAVA.在linux下开发JAVA还数eclip ...

  3. [Linux] deepin15.8搭建LNMP环境

    LAMP和LNMP LAMP==Linux+Apache+Mysql+PHP LNMP==Linux+Nginx+Mysql+PHP 安装nginx sudo apt install nginx 安装 ...

  4. 3.了解linux系统以及搭建学习环境

    目录: 1.linux的前世今生. 2.企业如何选择linux系统? 3.如何在虚拟机上安装linux系统?搭建学习环境. 1.linux的前世今生. 1).起源:先是贝尔实验室的Unix系统,因为各 ...

  5. freescale-sdk linux移植一搭建编译环境脚本host-prepare.sh分析

    接下来使用自己的课外歇息时间,对基于PowerPC架构freescale-sdk,进行linux移植和分析.主要參考官方文档freescale linux sdk START_HERE.html,首先 ...

  6. Linux程序设计(搭建开发环境--curses)

    看官们.咱们今天要说的内容.是前面内容的一点小补充,详细的内容是:安装curses开发包.以搭建 开发环境.闲话休说,言归正转. 我们在前面说过搭建开发环境的内容,主要说了开发环境中的GCC和VIM, ...

  7. Linux 18.04 搭建lamp环境

    Linux 18.04 下搭建lamp环境 一.      安装服务器 a)     在配置好sources.list文件后,apt-get updata&upgrade更新软件: 二.    ...

  8. linux系统下搭建php环境之-Discuz论坛

    1.安装搭建论坛必要的软件 apache php mysql CentOS系统我们可以直接使用 yum install 的方式进行软件安装,腾讯云有提供软件安装源,是同步CentOS官方的安装源,包涵 ...

  9. golang微服务框架go-micro 入门笔记1.搭建 go-micro环境

    微服务的本质是让专业的人做专业的事情,做出更好的东西. golang具备高并发,静态编译等特性,在性能.安全等方面具备非常大的优势.go-micro是基于golang的微服务编程框架,go-micro ...

随机推荐

  1. Java 8新增的Lambda表达式

    一. 表达式入门 Lambda表达式支持将代码块作为方法参数,lambda表达式允许使用更简洁的代码来创建只有一个抽象方法的接口(这种接口被称为函数式接口)的实例,相当于一个匿名的方法. 1.1 La ...

  2. 洛谷P2569 股票交易【dp】【单调队列】

    题目描述 最近 \text{lxhgww}lxhgww 又迷上了投资股票,通过一段时间的观察和学习,他总结出了股票行情的一些规律. 通过一段时间的观察,\text{lxhgww}lxhgww 预测到了 ...

  3. Pangolin中opengl的混合(gl_blend)

    Blend 混合是将源色和目标色以某种方式混合生成特效的技术.混合常用来绘制透明或半透明的物体.在混合中起关键作用的α值实际上是将源色和目标色按给定比率进行混合,以达到不同程度的透明.α值为0则完全透 ...

  4. LDA模型数据的可视化

    """ 执行lda2vec.ipnb中的代码 模型LDA 功能:训练好后模型数据的可视化 """ from lda2vec import p ...

  5. 双节点weblogic集群安装

    一.准备工作 1.环境信息规划 Server name Ip地址 Port 备注 AdminServer 192.168.100.175 7001 管理服务器 Ms1 192.168.100.175 ...

  6. 《前端JavaScript面试技巧》笔记一

    思考: 拿到一个面试题,你第一时间看到的是什么 -> 考点 又如何看待网上搜出来的永远也看不完的题海 -> 不变应万变 如何对待接下来遇到的面试题 -> 题目到知识再到题目 知识体系 ...

  7. Why should we typedef a struct so often in C? - Stack Overflow

    https://stackoverflow.com/questions/252780/why-should-we-typedef-a-struct-so-often-in-c As Greg Hewg ...

  8. iOS常用基础框架

    一,简述  1.1,IOS操作系统的层次架构         iOS为应用程序开发提供了许多可使用的框架,并构成IOS操作系统的层次架构,分为四层,从上到下依次为:Cocoa Touch Layer( ...

  9. centos7设置iptables

    https://www.linuxidc.com/Linux/2017-10/147238.htm

  10. Reporting Service Url传递参数应用

    与sharepoint集成的报表传递参数示例: http://reportserver/reportcenter/_layouts/ReportServer/RSViewerPage.aspx?rv: ...