【亚洲必赢官网】编写翻译安装javascript,Centos系统一体化安装python流程

一、环境

系统:Centos7

Python:3.6.5  自带pip、setuptools

相关连接:
http://www.jb51.net/article/113980.htm
基础环境陈设:
yum -y install gcc kernel-devel kenel-headers make bzip2 # 安装正视库

翻开是还是不是业已安装Python

# Centos7默认的 repo有限, 安装epel

二、命令

说的多,不比直接上命令:

 

yum install readline readline-devel readline-static -y
yum install openssl openssl-devel openssl-static -y #
不然导致pip安装战败
yum install sqlite-devel -y
yum install bzip2-devel bzip2-libs -y
yum install patch vim git # 额外的软件
【亚洲必赢官网】编写翻译安装javascript,Centos系统一体化安装python流程。yum install tcl-devel
yum install tk-devel

CentOS 7.二 默许安装了python2.柒.5 因为一些命令要用它比如yum
它利用的是python二.7.5。

rpm -ivh

壹,安装依赖

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel
sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel
xz-devel gcc kernel-devel kenel-headers make bzip2 gcc-c++ zlib
zlib-devel libffi-devel

 

表明:不设置信赖,会促成1部分装置后的题目,比如:pip、setuptools未有设置

参考:

https://www.cnblogs.com/bigriverx/p/8743008.html

https://www.cnblogs.com/zhangxinqi/p/9074546.html

 

安装python3.3

$ sudo mkdir /usr/local/python3 # 创制安装目录
$ wget –no-check-certificate
https://www.python.org/ftp/python/3.5.4/Python-3.5.4.tgz
#下载源文件。注意:wget获取https的时候要添加:–no-check-certificate
$ tar -xzvf Python-3.5.4.tgz # 解压缩包
此时此刻得以一向利用 tar -xvJf P**.tar.xz来解压
$ cd Python-3.6.0 # 进入解压目录

选拔 python -V 命令查看一下是不是安装Python

设置python三.陆恐怕利用的依赖性

二,下载安装包

mkdir /usr/local/python3

cd /usr/local/python3

wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz

 

释疑:也能够在Windows上下载,通过xftp传到linx上

参考:https://jingyan.baidu.com/article/425e69e60cc78abe14fc1640.html

 

编写翻译安装

接下来利用命令 which python 查看一下Python可执行文件的岗位

# yum install openssl-devel bzip2-devel expat-devel gdbm-devel
readline-devel sqlite-devel

三,解压安装,设置安装路径

tar zxvf Python-3.6.5.tgz

mkdir /usr/local/python365

cd Python-3.6.5

./configure –prefix=/usr/local/python365

make

make install

 

解释:

tar是解压tgz包

./configure –prefix… 是设置python的安装地点

make 是编写翻译源代码,生成指标文件、可执行文件

make install 将编写翻译成功的文件,安装到系统目录,一般为/usl/local/bin

 

./configure –prefix=/usr/local/python3 # 内定创制的目录

亚洲必赢官网 1

下载python三.陆编写翻译安装

四,设置软连接

cd  /usr/bin

ll -al python*

mv python python.bak

ln -s /usr/local/python365/bin/python3 /usr/bin/python

ln -s /usr/local/python365/bin/pip3 /usr/bin/pip

 

解释:

ll -al python*  查看当前目录含有python的文件并体现软连接

mv python python.bak 因为要设置python命令是运作python三,须要把系统自带的备份后删除

ln -s 目的路径 链接路径

 

make 编译

image

到python官网下载https://www.python.org

伍,设置环境变量

vi  /etc/profile

export PATH=$PATH:/usr/local/Python365/bin

 

source  /etc/profile       –centos六X须求跟新环境布置

 

解释:编辑环境变量文件,那是永远设置,约等于Windows系统:系统变量Path

参考:http://www.voidcn.com/article/p-hcyvuwuz-bqy.html

 

make altinstall 不掩盖安装,不建议选取makeinstall 会覆盖

make distclean
就好像make clean,但与此同时也将configure生成的文本全部刨除掉,包蕴Makefile。

看得出执行文书在/usr/bin/ 目录下,切换来该目录下进行 ll python* 命令查看

下载最新版源码,使用make altinstall,假设采用make
install,在系统旅长会有七个分化版本的Python在/usr/bin/目录中。那将会招致比比皆是标题,而且倒霉处理。

6,恢复yum依赖的python2

vi /usr/bin/yum

把文件起先第2行的 
#!/usr/bin/python

改成  #!/usr/bin/python二.7  那样就足以了。

 

配置软连接

ln ./pytho3.6_install/bin/python3.6 python3.6 -s

亚洲必赢官网 2

# wget

柒,更新和测试

python –version

python

pip list

pip install –upgrade pip

 

解释:

python –version 当前python版本号

python  进入python交互环境

pip list 测试pip暗许安装的列表,会有桃色提示要更新

pip install –upgrade pip 更新pip

设置虚拟环境

pip install virtualenv
pip install pipenv

image

# tar -xzvf Python-3.6.4.tgz -C  /tmp

pipenv安装失败 错误’install_requires’ must

pip install -U setuptools

python 指向的是python二.七

# cd /tmp/Python-3.6.4/

配备安装pip,暗中同意源是2.七.伍不可能安装pip

  1. 安装重视环境

把Python3.6安装到/usr/local 目录

参照链接:http://blog.csdn.net/hlj19940416/article/details/53195664

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel
sqlite-devel readline-devel tk-devel gdbm-devel db4-devel
libpcap-devel xz-devel

# ./configure –prefix=/usr/local/

yum install epel-release

  1. 浏览器打开
    https://www.python.org/ftp/python/
    查看最新的Python版本,标记为叁.A.B

note: 如遇到 “error: no acceptable C compiler found in $PATH”

yum install python-pip

wget
https://www.python.org/ftp/python/3.A.B/Python-3.A.B.tgz

[root@localhost Python-3.6.4]# yum install gcc -y

pip install –upgrade pip

  1. 创建Python3的目录

# make

设置虚拟环境模块

mkdir /usr/local/python3

# make altinstall

链接: https://www.cnblogs.com/justbreaking/p/7103234.html

pip install -i
https://pypi.douban.com/simple/
virtualenvwrapper

  1. 解压下载文件并切换目录

Note: 如遇错误,请安装重视包。

豆瓣源使用越发:

处理:
pip install -i
http://pypi.douban.com/simple/
virtualenvwrapper # 先使用http进行接二连三
pip install -i
https://pypi.douban.com/simple/
virtualenvwrapper# ,再使用https连接

mkdir ~/.virtualenvs
在.bashrc中最后添加
export WORKON_HOME=~/.virtualenvs
source /usr/bin/virtualenvwrapper.sh
source ~/.bashrc

tar -zxvf Python-3.A.B.tgz

cd Python-3.A.B

zipimport.ZipImportError: can’t decompress data; zlib not available

陈设python三的虚拟环境work

mkvirtualnenv
mkvirtualenv –python=/usr/local/python3/bin/python3.5 work

  1. 执行

make: *** [altinstall] Error 1

配置

ssh-keygen

./configure –prefix=/usr/local/python3

make && make install

[root@localhost Python-3.6.4]# yum install bzip2-devel -y

布置1个版本共存

$ sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python3 #创建python三 的软链接,那样就足以通过 python 命令使用 Python 二,python3来利用 Python 叁。

  1. 开创Python三的软链接

[root@localhost Python-3.6.4]# yum install zlib-devel -y

修改私下认可为 Python 3

$ sudo mv python python.bak
$ sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python #缔造python③ 的软链接
$ sudo vi /usr/bin/yum #因为 yum 使用 Python 二,因而替换为 Python 三后只怕不能够正常干活,由此修改 yum 配置文件。将首先行钦赐的 python
版本改为 python二.七(#!/usr/bin/python 改为 #!/usr/bin/python2.7)

ln -s /usr/local/python3/bin/python3 /usr/bin/python3

[root@localhost Python-3.6.4]# yum install zlib2 -y

  1. 始建Pip叁的软链接

[root@localhost Python-3.6.4]# yum install zlib -y

亚洲必赢官网 ,ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3


  1. 测试命令 python三 和 pip三

python3 安装成功,信息如下:

python3

pip3

。。。。

设置保留了原python命令调用python2

Collecting setuptools

设置到位

Collecting pip

Installing collected packages: setuptools, pip

Successfully installed pip-9.0.1 setuptools-28.8.0


python3.陆程序的执行文书:/usr/local/bin/python三.6

python3.陆应用程序目录:/usr/local/lib/python三.6

pip三的实行理文件书:/usr/local/bin/pip三.陆

pyenv三的履行文书:/usr/local/bin/pyenv-3.陆

[root@localhost Python-3.6.4]# whereis pip

pip: /usr/local/bin/pip3.6

[root@localhost Python-3.6.4]#

更改/usr/bin/python链接 (默认是Python2.7)

[root@localhost Python-3.6.4]# ls -l /usr/bin/python*

lrwxrwxrwx. 1 root root    7 Jan 20  2018 /usr/bin/python -> python2

lrwxrwxrwx. 1 root root    9 Jan 20  2018 /usr/bin/python2 ->
python2.7

-rwxr-xr-x. 1 root root 7136 Aug  3 20:40 /usr/bin/python2.7

# cd /usr/bin

# mv  python python.backup

# ln -s /usr/local/bin/python3.6 /usr/bin/python

# ln -s /usr/local/bin/python3.6 /usr/bin/python3

时至明天,python3早就安装完成,测试一下:

[root@localhost bin]# whereis python

python: /usr/bin/python /usr/bin/python2.7 /usr/bin/python.backup
/usr/lib/python2.7 /usr/lib64/python2.7 /etc/python
/usr/local/bin/python3.6m /usr/local/bin/python3.6
/usr/local/bin/python3.6m-config /usr/local/lib/python3.6
/usr/include/python2.7 /usr/share/man/man1/python.1.gz

[root@localhost bin]# python

Python 3.6.4 (default, Jan 20 2018, 03:11:08)

[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux

Type “help”, “copyright”, “credits” or “license” for more information.

Important:

一.修改剧本

Centos7下过多脚本是依照python2.柒的,安装完python三今后,很多脚本不可能通常使用(比如yum),
要求在剧本文件起头更改:

#!/usr/bin/python   ===》 #!/usr/bin/python2.7

2.pip3.6 install django

会报错!!

譬如那样:

pip is configured with locations that require TLS/SSL, however the ssl
module in Python is not available.

Collecting xxx

Could not fetch
URLhttps://pypi.python.org/simple/xxxx/:
There was a problem confirming the ssl certificate: Can’t connect to
HTTPS URL because the SSL module is not available. – skipping

Could not find a version that satisfies the requirement xxx (from
versions: )

No matching distribution found for xxx

===》solution:

yum install openssl-devel

重新 make & make install 

===> 这表明 要先装python的重视包,先装python的借助包,先装python的正视性包,重要业务说贰回! 然后 make & make install 等等

 
Centos柒服务器搭建django项目

网站地图xml地图