<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>兄弟会-张冲霄</title>
    <description>欢迎来到我的个人站~</description>
    <link>https://zcxiao74.github.io//</link>
    <atom:link href="https://zcxiao74.github.io//feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Thu, 12 Dec 2019 09:20:08 +0000</pubDate>
    <lastBuildDate>Thu, 12 Dec 2019 09:20:08 +0000</lastBuildDate>
    <generator>Jekyll v3.8.5</generator>
    
      <item>
        <title>Docker搭建hadoop</title>
        <description>&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;layout: post
title: &quot;docker搭建hadoop&quot;
date: 2019-12-06
tags: hadoop  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h1 id=&quot;docker搭建hadoop&quot;&gt;docker搭建hadoop&lt;/h1&gt;

&lt;h2 id=&quot;配置加速器&quot;&gt;配置加速器&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd /etc/docker
vim /etc/docker/daemon.json

{&quot;registry-mirrors&quot;: [&quot;https://lqbkkmob.mirror.aliyuncs.com&quot;]}

sudo systemctl daemon-reload
sudo systemctl restart docker
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;可选项&quot;&gt;可选项&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;newgrp docker	#更新用户组，获取权限
docker save [id] -o [path/name.tar]	#备份镜像
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;docker镜像操作&quot;&gt;Docker镜像操作&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# 远程拉取镜像
docker pull ubuntu

# 在Docker上运行Ubuntu镜像，设置共享目录
docker run -it -v /home/xiao/hadoop:/root/build --name ubuntu ubuntu
$ docker run -it 64613b7ea5bf /bin/bash(单独运行镜像)

# 退出容器并返回
exit / CTRL+P+Q
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;这里解析下这个命令参数：
* docker run 表示运行一个镜像；
* -i表示开启交互式；-t表示分配一个tty，可以理解为一个控制台；因此-it可以理解为在当前终端上与docker内部的ubuntu系统交互；
* -v 表示docker内部的ubuntu系统/root/build目录与本地/home/hadoop/build共享；这可以很方便将本地文件上传到Docker内部的Ubuntu系统；
* –name ubuntu 表示Ubuntu镜像启动名称，如果没有指定，那么Docker将会随机分配一个名字；
* ubuntu 表示docker run启动的镜像文件；
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;ubuntu系统初始化&quot;&gt;Ubuntu系统初始化&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get update
apt-get install vim
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;安装sshd&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get install ssh
/etc/init.d/ssh start	# 开启sshd服务器
vim ~/.bashrc
/etc/init.d/ssh start	# 最后一行添加(自启服务)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;配置sshd&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh-keygen -t rsa #一直按回车键即可
cd ~/.ssh/
cat id_rsa.pub &amp;gt;&amp;gt; authorized_keys
cat authorized_keys		# 查看
ssh localhost	# 验证

vim /etc/ssh/sshd_config

Port 22
PermitRootLogin yes
PubkeyAuthentication yes
PasswordAuthentication yes
ChallengeResponseAuthentication no
UsePAM yes
PrintLastLog no

vim /etc/ssh/ssh_config
StrictHostKeyChecking no(大约35行)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;安装JDK&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
vim /etc/profile
vim /etc/bash.bashrc

## 最后输入
export JAVA_HOME=/usr/local/jdk1.8
export HADOOP_HOME=/usr/local/hadoop-3.2.1
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin

source /etc/profile
source /etc/bash.bashrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;保存镜像文件&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;https://hub.docker.com	# 注册一个账号
docker login	# 登录，输入用户名密码
docker ps	# 查看当前运行的容器信息
docker commit [ID] ubuntu/jdked	# 保存当前镜像为ubuntu/jdked
docker images	# 检查
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;安装hadoop&quot;&gt;安装Hadoop&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# 启动镜像
docker run -it -v /home/xiao/hadoop:/root/build --name ubuntu-jdked ubuntu/jdked

# 镜像
docker ps

#进入到运行的容器
docker exec -it 6b97011d772c /bin/bash
docker attach 876d911b2bfb

# 解压hadoop安装包
cd /root/build
tar -zxvf hadoop-3.2.1.tar.gz -C /usr/local

# 配置JAVA_HOME
vim /usr/local/hadoop-3.2.1/etc/hadoop/hadoop-env.sh
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/

# 检查
cd /usr/local/hadoop-3.2.1
./bin/hadoop version
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;##　配置Hadoop集群&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd /usr/local/hadoop-3.2.1/etc/hadoop
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;设置环境变量&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vi /etc/profile

export HADOOP_HOME=/usr/local/hadoop-3.2.1
export PATH=$PATH:$HADOOP_HOME/bin

source /etc/profile
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在/hadoop/sbin路径下：
将start-dfs.sh，stop-dfs.sh两个文件[顶部]添加以下参数&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;#!/usr/bin/env bash
HDFS_DATANODE_USER=root
HADOOP_SECURE_DN_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;start-yarn.sh，stop-yarn.sh[顶部]也需添加以下：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;#!/usr/bin/env bash
YARN_RESOURCEMANAGER_USER=root
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=root
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;vim core-site.xml&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;configuration&amp;gt;
        &amp;lt;property&amp;gt;
                &amp;lt;name&amp;gt;hadoop.tmp.dir&amp;lt;/name&amp;gt;
                &amp;lt;value&amp;gt;file:/usr/local/hadoop-3.2.1/tmp&amp;lt;/value&amp;gt;
                &amp;lt;description&amp;gt;namenode上本地的hadoop临时文件夹&amp;lt;/description&amp;gt;
      &amp;lt;/property&amp;gt;
      &amp;lt;property&amp;gt;
                &amp;lt;name&amp;gt;fs.defaultFS&amp;lt;/name&amp;gt;
                &amp;lt;value&amp;gt;hdfs://master:9000&amp;lt;/value&amp;gt;
                &amp;lt;description&amp;gt;HDFS的URI，文件系统://namenode标识:端口号&amp;lt;/description&amp;gt;
      &amp;lt;/property&amp;gt;
&amp;lt;/configuration&amp;gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;vim hdfs-site.xml&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;configuration&amp;gt;
        &amp;lt;property&amp;gt;
                &amp;lt;name&amp;gt;dfs.namenode.name.dir&amp;lt;/name&amp;gt;
                &amp;lt;value&amp;gt;file:/usr/local/hadoop-3.2.1/namenode_dir&amp;lt;/value&amp;gt;
        &amp;lt;/property&amp;gt;
        &amp;lt;property&amp;gt;
                &amp;lt;name&amp;gt;dfs.datanode.data.dir&amp;lt;/name&amp;gt;
                &amp;lt;value&amp;gt;file:/usr/local/hadoop-3.2.1/datanode_dir&amp;lt;/value&amp;gt;
        &amp;lt;/property&amp;gt;
        &amp;lt;property&amp;gt;
                &amp;lt;name&amp;gt;dfs.replication&amp;lt;/name&amp;gt;
                &amp;lt;value&amp;gt;3&amp;lt;/value&amp;gt;
                &amp;lt;description&amp;gt;副本个数，配置默认是3,应小于datanode机器数量&amp;lt;/description&amp;gt;
        &amp;lt;/property&amp;gt;
	&amp;lt;property&amp;gt;
		&amp;lt;name&amp;gt;dfs.namenode.http-address&amp;lt;/name&amp;gt;
		&amp;lt;value&amp;gt;master:9870&amp;lt;/value&amp;gt;
		&amp;lt;description&amp;gt;注意每个节点配置各自的,9870不变&amp;lt;/description&amp;gt;
	&amp;lt;/property&amp;gt;
&amp;lt;/configuration&amp;gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;vim mapred-site.xml&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;configuration&amp;gt;
	&amp;lt;property&amp;gt;
		&amp;lt;name&amp;gt;mapreduce.framework.name&amp;lt;/name&amp;gt;
		&amp;lt;value&amp;gt;yarn&amp;lt;/value&amp;gt;
	&amp;lt;/property&amp;gt;
&amp;lt;/configuration&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;vim yarn-site.xml&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;configuration&amp;gt;
	&amp;lt;!--nomenodeManager获取数据的方式是shuffle--&amp;gt;
	&amp;lt;property&amp;gt;
		&amp;lt;name&amp;gt;yarn.nodemanager.aux-services&amp;lt;/name&amp;gt;
		&amp;lt;value&amp;gt;mapreduce_shuffle&amp;lt;/value&amp;gt;
	&amp;lt;/property&amp;gt;
	&amp;lt;!--指定Yarn的老大(ResourceManager)的地址--&amp;gt;
	&amp;lt;property&amp;gt;
		&amp;lt;name&amp;gt;yarn.resourcemanager.hostname&amp;lt;/name&amp;gt;
		&amp;lt;value&amp;gt;master&amp;lt;/value&amp;gt;
	&amp;lt;/property&amp;gt;
&amp;lt;/configuration&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;保存镜像(把容器打包成镜像)&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo docker commit 6b97011d772c ubuntu-hadoop
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;三个终端上分别运行ubuntu-hadoop&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker run -it -h master --name master ubuntu-hadoop
docker run -it -h slave01 --name slave01 ubuntu-hadoop
docker run -it -h slave02 --name slave02 ubuntu-hadoop

# 查看容器ip
docker inspect -f ' - ' $(docker ps -aq) 

vim /etc/hosts
172.17.0.2      master
172.17.0.3      slave01
172.17.0.4      slave02

# 检测
ssh slave01
ssh slave02

# 备份镜像(可选)
sudo docker commit [id] hadoop-master
sudo docker commit [id] hadoop-slave01
sudo docker commit [id] hadoop-slave02
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;vim /usr/local/hadoop-3.2.1/etc/hadoop/workers (master)&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# 将localhost替换成两个slave的主机名
slave01
slave02
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;启动集群&quot;&gt;启动集群&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;master:
cd /usr/local/hadoop-3.2.1
bin/hdfs namenode -format(格式化)
sbin/start-all.sh

浏览器检查：http://172.17.0.2:9870/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;##　重启容器后&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;注意容器启动顺序不能乱：
docker start master slave01 slave02

docker attach master
docker attach slave01
docker attach slave02

echo -e &quot;172.17.0.2\\tmaster\\n172.17.0.3\\tslave01\\n172.17.0.4\\tslave02&quot; &amp;gt;&amp;gt; /etc/hosts

/usr/local/hadoop-3.2.1/sbin/start-all.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Fri, 06 Dec 2019 00:00:00 +0000</pubDate>
        <link>https://zcxiao74.github.io//2019/12/docker%E6%90%AD%E5%BB%BAhadoop/</link>
        <guid isPermaLink="true">https://zcxiao74.github.io//2019/12/docker%E6%90%AD%E5%BB%BAhadoop/</guid>
        
        
      </item>
    
      <item>
        <title>Docker常用命令</title>
        <description>&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;layout: post
title: &quot;Docker常用命令&quot;
date: 2019-12-06
tags: docker  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;docker常用命令&quot;&gt;Docker常用命令&lt;/h1&gt;

&lt;p&gt;查看镜像/容器&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker images
docker ps
docker ps -a
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;远程拉取镜像&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker pull ubuntu
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;从本地导入镜像&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker import  [path/name.tar] [name] 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在Docker上运行Ubuntu镜像，设置共享目录&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker run -itv [本地path]:[镜像path] [镜像名] /bin/bash
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;拷贝本地文件到容器&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker inspect -f '' master
docker cp 你的文件路径 容器长ID:docker容器路径
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;运行镜像&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker run -it [id] /bin/bash

例：
docker run -it -h master --name master ubuntu-hadoop
docker run -it -h slave01 --name slave01 ubuntu-hadoop
docker run -it -h slave02 --name slave02 ubuntu-hadoop
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;保存镜像到本地&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker save [id] -o [path/name.tar]	
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;进入到运行的容器&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker exec -it [id] /bin/bash
docker attach [id]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;容器打包成镜像&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo docker commit [容器id] [name]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;关闭容器&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker stop [id]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;停止所有容器&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker stop $(docker ps -aq)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;删除所有容器&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker rm `docker ps -a -q`
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;删除所有镜像&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker rmi `docker images -q`
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;查看容器ip&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker inspect -f ' - ' $(docker ps -aq) 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
        <pubDate>Fri, 06 Dec 2019 00:00:00 +0000</pubDate>
        <link>https://zcxiao74.github.io//2019/12/Docker%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4/</link>
        <guid isPermaLink="true">https://zcxiao74.github.io//2019/12/Docker%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4/</guid>
        
        
      </item>
    
      <item>
        <title>Deepin安装jdk及永久配置方法</title>
        <description>&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;layout: post
title: &quot;deepin安装jdk及永久配置方法&quot;
date: 2019-12-04
tags: java  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;deepin安装jdk及永久配置方法&quot;&gt;deepin安装jdk及永久配置方法&lt;/h1&gt;

&lt;h2 id=&quot;解压安装&quot;&gt;解压安装&lt;/h2&gt;

&lt;h2 id=&quot;修改配置文件&quot;&gt;修改配置文件&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo vim /etc/profile
sudo vim /etc/bash.bashrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;最后写入&quot;&gt;最后写入&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;JAVA_HOME=/home/xiao/develop/jdk1.8.0
CLASSPATH=.:$JAVA_HOME/bin.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;生效&quot;&gt;生效&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;source /etc/profile
source /etc/bash.bashrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Wed, 04 Dec 2019 00:00:00 +0000</pubDate>
        <link>https://zcxiao74.github.io//2019/12/deepin%E5%AE%89%E8%A3%85jdk%E5%8F%8A%E6%B0%B8%E4%B9%85%E9%85%8D%E7%BD%AE%E6%96%B9%E6%B3%95/</link>
        <guid isPermaLink="true">https://zcxiao74.github.io//2019/12/deepin%E5%AE%89%E8%A3%85jdk%E5%8F%8A%E6%B0%B8%E4%B9%85%E9%85%8D%E7%BD%AE%E6%96%B9%E6%B3%95/</guid>
        
        
      </item>
    
      <item>
        <title>Deepin 安装 docker Ce</title>
        <description>&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;layout: post
title: &quot;deepin 安装 docker-ce&quot;
date: 2019-12-04
tags: docker
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;deepin-安装-docker-ce&quot;&gt;deepin 安装 docker-ce&lt;/h1&gt;

&lt;h2 id=&quot;先卸载&quot;&gt;先卸载&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get remove docker docker-engine docker.io
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;安装依赖&quot;&gt;安装依赖&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;信任-docker-的-gpg-公钥&quot;&gt;信任 Docker 的 GPG 公钥: &lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;安装&quot;&gt;安装&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get update
sudo apt-get install docker-ce
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;给予权限不需要每次都sudo&quot;&gt;给予权限(不需要每次都sudo)&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;#添加docker用户组
sudo groupadd docker

#将登陆用户加入到docker用户组中
sudo gpasswd -a $USER docker

#更新用户组
newgrp docker

#测试docker命令是否可以使用sudo正常使用
docker ps
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Wed, 04 Dec 2019 00:00:00 +0000</pubDate>
        <link>https://zcxiao74.github.io//2019/12/deepin-%E5%AE%89%E8%A3%85-docker-ce/</link>
        <guid isPermaLink="true">https://zcxiao74.github.io//2019/12/deepin-%E5%AE%89%E8%A3%85-docker-ce/</guid>
        
        
      </item>
    
      <item>
        <title>Python3.8安装报错问题</title>
        <description>&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;layout: post

title: &quot;python3.8安装报错问题&quot;

date: 2019-12-01

tags: python  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;安装python37出现modulenotfounderror-no-module-named-_ctypes解决办法&quot;&gt;安装python3.7出现ModuleNotFoundError: No module named ‘_ctypes’解决办法&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus
sudo apt-get install build-essential libncursesw5-dev libgdbm-dev libc6-dev
sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
sudo apt-get install libssl-dev openssl
sudo apt-get install libffi-dev
sudo apt-get install openssl
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;e-sub-process-usrbindpkg-returned-an-error-code-1&quot;&gt;E: Sub-process /usr/bin/dpkg returned an error code (1)&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_old 　　　　——现将info文件夹更名
sudo mkdir /var/lib/dpkg/info 　　　　　　　　　　　　 ——再新建一个新的info文件夹
sudo apt-get update　　　　　　　　　　　　　　　　 ——更新软件源
sudo apt-get -f install 
sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info_old  　　　 ——执行完上一步操作后会在新的info文件夹下生成一些文件，现将这些文件全部移到info_old文件夹下
sudo rm -rf /var/lib/dpkg/info 　　　　　　　　　　　　  ——把自己新建的info文件夹删掉
sudo mv /var/lib/dpkg/info_old /var/lib/dpkg/info 　　　　 ——把以前的info文件夹重新改回名字
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;non-zero-exit-code-1&quot;&gt;Non-zero exit code (1)&lt;/h3&gt;

&lt;h3 id=&quot;pip-is-configured-with-locations-that-require-tlsssl-however-the-ssl-module-in-python-is-not-available&quot;&gt;pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./configure --enable-optimizations --with-ssl
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;编译安装&quot;&gt;编译安装&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd Python-3.8.0
sudo make &amp;amp;&amp;amp; sudo make install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;error-command-errored-out-with-exit-status-1-python-setuppy-egg_info-check-the-logs-for-full-command-output&quot;&gt;ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get install libpq-dev python-dev
pip install psycopg2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Sun, 01 Dec 2019 00:00:00 +0000</pubDate>
        <link>https://zcxiao74.github.io//2019/12/python3.8%E5%AE%89%E8%A3%85%E6%8A%A5%E9%94%99%E9%97%AE%E9%A2%98/</link>
        <guid isPermaLink="true">https://zcxiao74.github.io//2019/12/python3.8%E5%AE%89%E8%A3%85%E6%8A%A5%E9%94%99%E9%97%AE%E9%A2%98/</guid>
        
        
      </item>
    
      <item>
        <title>Deepin 安装 docker Ce</title>
        <description>&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;layout: post
title: &quot;deepin 安装 docker-ce&quot;
date: 2019-12-04
tags: docker
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;deepin-安装-docker-ce&quot;&gt;deepin 安装 docker-ce&lt;/h1&gt;

&lt;h2 id=&quot;先卸载&quot;&gt;先卸载&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get remove docker docker-engine docker.io
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;安装依赖&quot;&gt;安装依赖&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;信任-docker-的-gpg-公钥&quot;&gt;信任 Docker 的 GPG 公钥: &lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;安装&quot;&gt;安装&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get update
sudo apt-get install docker-ce
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;给予权限不需要每次都sudo&quot;&gt;给予权限(不需要每次都sudo)&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;#添加docker用户组
sudo groupadd docker

#将登陆用户加入到docker用户组中
sudo gpasswd -a $USER docker

#更新用户组
newgrp docker

#测试docker命令是否可以使用sudo正常使用
docker ps
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
        <pubDate>Sun, 01 Dec 2019 00:00:00 +0000</pubDate>
        <link>https://zcxiao74.github.io//2019/12/deepin-%E5%AE%89%E8%A3%85-docker-ce/</link>
        <guid isPermaLink="true">https://zcxiao74.github.io//2019/12/deepin-%E5%AE%89%E8%A3%85-docker-ce/</guid>
        
        
      </item>
    
      <item>
        <title>deepin 安装 python3.8.0</title>
        <description>&lt;h1 id=&quot;deepin-安装-python380&quot;&gt;deepin 安装 python3.8.0&lt;/h1&gt;

&lt;h2 id=&quot;下载源码&quot;&gt;下载源码&lt;/h2&gt;
&lt;h2 id=&quot;解压源码&quot;&gt;解压源码&lt;/h2&gt;
&lt;h2 id=&quot;进入目录&quot;&gt;进入目录&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd Python-3.8.0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;配置安装路径&quot;&gt;配置安装路径&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo ./configure --prefix=/usr/local/python-3.8.0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;编译安装&quot;&gt;编译安装&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo make &amp;amp;&amp;amp; sudo make install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;查看默认指向&quot;&gt;查看默认指向&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ls -l /usr/bin/python
ls -l /usr/bin/python3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;建立软连接&quot;&gt;建立软连接&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo rm -rf python
sudo ln -s /usr/local/python-3.8.0/bin/python3.8 python
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;检查&quot;&gt;检查&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
        <pubDate>Fri, 22 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://zcxiao74.github.io//2019/11/deepin-%E5%AE%89%E8%A3%85-python3.8/</link>
        <guid isPermaLink="true">https://zcxiao74.github.io//2019/11/deepin-%E5%AE%89%E8%A3%85-python3.8/</guid>
        
        <category>python</category>
        
        
      </item>
    
      <item>
        <title>Python配置文件</title>
        <description>&lt;h1 id=&quot;python配置文件&quot;&gt;python配置文件&lt;/h1&gt;

&lt;h2 id=&quot;ini配置文件&quot;&gt;.ini配置文件&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[pgsql]
host = localhost
user = postgres
password = pgsql
database = MedicalBigData
port = 5432
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;py&quot;&gt;.py&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;config = configparser.ConfigParser()
config.read(&quot;config/config.ini&quot;, encoding=&quot;utf-8&quot;)
user = config.get(&quot;pgsql&quot;, &quot;user&quot;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
        <pubDate>Fri, 22 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://zcxiao74.github.io//2019/11/python%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6/</link>
        <guid isPermaLink="true">https://zcxiao74.github.io//2019/11/python%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6/</guid>
        
        
      </item>
    
      <item>
        <title>Ubuntu 升级 python3.7.1</title>
        <description>&lt;h1 id=&quot;ubuntu-升级-python371&quot;&gt;Ubuntu 升级 python3.7.1&lt;/h1&gt;

&lt;h2 id=&quot;下载源码&quot;&gt;下载源码&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;解压源码&quot;&gt;解压源码&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tar -xvzf Python-3.7.1.tgz
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;进入目录&quot;&gt;进入目录&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd Python-3.7.1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;配置安装路径&quot;&gt;配置安装路径&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./configure --with-ssl --prefix=/usr/local/python3
安装python3.7.1依赖
sudo apt-get update
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus libncursesw5-dev libgdbm-dev libc6-dev zlib1g-dev libsqlite3-dev tk-dev libssl-dev openssl libffi-dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;编译&quot;&gt;编译&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;make
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;安装&quot;&gt;安装&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo make install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;删除软链接&quot;&gt;删除软链接&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo rm -rf /usr/bin/python3
sudo rm -rf /usr/bin/pip3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;新建软链接&quot;&gt;新建软链接?&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
sudo ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;检查&quot;&gt;检查&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;修复安装后无法打开-terminal-的问题&quot;&gt;修复安装后无法打开 Terminal 的问题&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd /usr/lib/python3/dist-packages/gi/

sudo cp _gi.cpython-35m-x86_64-linux-gnu.so _gi.cpython-37m-x86_64-linux-gnu.so

sudo cp _gi_cairo.cpython-35m-x86_64-linux-gnu.so _gi_cairo.cpython-37m-x86_64-linux-gnu.so
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;```
 \将 gi 模块拷贝到安装路径下的对应目录&lt;/p&gt;

&lt;p&gt;sudo cp -r /usr/lib/python3/dist-packages/gi /usr/local/python3/lib/python3.7/site-packages/&lt;/p&gt;

&lt;p&gt;``&lt;/p&gt;
</description>
        <pubDate>Fri, 22 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://zcxiao74.github.io//2019/11/Ubuntu%E4%B8%8B%E5%8D%87%E7%BA%A7-python3.7/</link>
        <guid isPermaLink="true">https://zcxiao74.github.io//2019/11/Ubuntu%E4%B8%8B%E5%8D%87%E7%BA%A7-python3.7/</guid>
        
        <category>python</category>
        
        
      </item>
    
      <item>
        <title>ubuntu 升级 python版本</title>
        <description>&lt;h1 id=&quot;ubuntu-升级-python版本&quot;&gt;ubuntu 升级 python版本&lt;/h1&gt;

&lt;h2 id=&quot;1查看已安装版本&quot;&gt;1.查看已安装版本&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python2 --version   #查看python2安装版本
python3 --version   #查看python3安装版本
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;2使用python3&quot;&gt;2.使用python3&lt;/h2&gt;

&lt;p&gt;查看默认python&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python --version
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;改为python3,终端输入&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;echo alias python=python3 &amp;gt;&amp;gt; ~/.bashrc
source ~/.bashrc
python --version
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
        <pubDate>Mon, 11 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://zcxiao74.github.io//2019/11/python%E7%89%88%E6%9C%AC%E5%8D%87%E7%BA%A7/</link>
        <guid isPermaLink="true">https://zcxiao74.github.io//2019/11/python%E7%89%88%E6%9C%AC%E5%8D%87%E7%BA%A7/</guid>
        
        <category>python</category>
        
        
      </item>
    
  </channel>
</rss>
