码迷,mamicode.com
首页 > 编程语言 > 详细

python3安装

时间:2019-10-18 19:17:09      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:browser   prefix   bzip2   rom   cat   root   pip   修改   注意   

python3 安装

yum install -y python36
                                            ln -s python3.6    python3
                                            
mv /usr/bin/python /usr/bin/python.bak
ln -s /usr/bin/python3.6  /usr/bin/python
vi /usr/bin/yum
把#! /usr/bin/python修改为#! /usr/bin/python2

sed  -i  's@/usr/bin/python@/usr/bin/python2@'  /usr/bin/yum

vi /usr/libexec/urlgrabber-ext-down
把#! /usr/bin/python 修改为#! /usr/bin/python2
sed  -i  's@/usr/bin/python@/usr/bin/python2@'  /usr/libexec/urlgrabber-ext-down



安装pip3
1. 安装easy_install
注意安装与以上python版本相同的setuptools

yum install -y python36-setuptools
2. 安装pip

安装之后,pip3位于/usr/local/bin目录下
 
python -V

CentOS 7安装python3
https://blog.csdn.net/lovefengruoqing/article/details/79284573
#python 在哪
[root@root ~]# whereis python
# cd /usr/bin/
# ll python*


下载编译python3的工具  依赖项
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make 

3.默认的,centos7也没有安装pip
#运行这个命令添加epel扩展源
yum -y install epel-release

#安装pip
yum install python-pip

4.用pip装wget
pip install wget
5.用wget下载python3的源码包
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz

6.编译python3源码包
#解压
xz -d       Python-3.6.4.tar.xz
tar -xfC       Python-3.6.4.tar

#进入解压后的目录,依次执行下面命令进行手动编译
./configure prefix=/usr/local/python3
make && make install
 7.添加软链接
#将原来的链接备份
mv /usr/bin/python /usr/bin/python.bak

#添加python3的软链接
ln -s /usr/local/python3/bin/python3.6 /usr/bin/python

#测试是否安装成功了
python -V
 8.更改yum配置,因为其要用到python2才能执行,否则会导致yum不能正常使用
vi /usr/bin/yum
把#! /usr/bin/python修改为#! /usr/bin/python2

vi /usr/libexec/urlgrabber-ext-down
把#! /usr/bin/python 修改为#! /usr/bin/python2


jupyter 安装

2  wget  https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.3.1-Linux-x86_64.sh
7  yum  install    bzip2
8  sh  Anaconda3-5.3.1-Linux-x86_64.sh   -u

12 cd anaconda3/
17 cd /root/anaconda3/
24 bin/jupyter-notebook --generate-config
25 cat /root/.jupyter/jupyter_notebook_config.py
26 vi /root/.jupyter/jupyter_notebook_config.py
30 export PATH=/root/anaconda3/bin:$PATH
31 ipython
32 vim ~/.jupyter/jupyter_notebook_config.py

grep   -v  "^#"    ~/.jupyter/jupyter_notebook_config.py   | grep -v  "^$"
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser =  False
c.NotebookApp.password = u'sha1:45b05f890fb6:3eaac1d849150baf87598a40f5aba6ef0634fa81'
c.NotebookApp.port = 8888

jupyter 起服务脚本

mkdir  /data
vi  python_service.py 
#!/usr/bin/env python
# encoding: utf-8
import subprocess
import sys

subprocess.call("cd /", shell=True)
subprocess.call("jupyter lab --ip=0.0.0.0 --no-browser --allow-root --NotebookApp.token='jupyterAdmin' --notebook-dir=/data", shell=True)




ROM  centos:7
MAINTAINER  yon@dataexa.com
ENV   JAVA_HOME    /usr/local/jdk
ENV   JRE_HOME     ${JAVA_HOME}/jre
ENV   CLASSPATH    .:${JAVA_HOME}/lib/tools.jar:${JRE_HOME}/lib/dt.jar
ENV   PATH         ${JAVA_HOME}/bin:${JAVA_HOME}/jre/bin:$PATH

ADD   jdk-8u152-linux-x64.tar.gz  /usr/local
RUN   ln  -s    /usr/local/jdk1.8.0_152      /usr/local/jdk

RUN   mkdir /home/dataexa/insight/log   -p  &&  mkdir   /home/dataexa/insight/jar  -p

EXPOSE  9030
COPY  exec-entrypoint.sh   /
RUN   chmod  +x  /exec-entrypoint.sh
COPY  insight-service-appmarket-5.0.0-SNAPSHOT.jar  /home/dataexa/insight/jar
CMD  ["sh","/exec-entrypoint.sh"]

python3安装

标签:browser   prefix   bzip2   rom   cat   root   pip   修改   注意   

原文地址:https://www.cnblogs.com/g2thend/p/11699862.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!