suse11 安装 python3.6 python3 安装步骤
首先需要去网上下载Python-3.6.4.tgz,libopenssl-devel-0.9.8j-2.1.x86_64.rpm zlib-devel-1.2.7-3.14.x86_64.rpm
linux-9qk9:/tmp/software_download # ls
Python-3.6.4 gnureadline-6.3.8 libopenssl-devel-0.9.8j-2.1.x86_64.rpm zlib-devel-1.2.7-3.14.x86_64.rpm
Python-3.6.4.tgz gnureadline-6.3.8.tar.gz setuptools-40.0.0.zip
linux-9qk9:/tmp/software_download # tar -zxvf Python-3.6.4.tgz
linux-9qk9:/tmp/software_download # cd Python-3.6.4/
随后需要去网上下载一些包,那么那些包是需要的呢,使用以下一个命令可以看到哪些包没有,用make的时候可以看到一堆包,那些标记skipped的没有,其中zlib,以及他的开发包zlib-devel, openssl,libopenssl-devel是必须的
--enable-optimizations可以检测需要的包,
linux-9qk9:/tmp/software_download/Python-3.6.4 # ./configure --prefix=/usr/local/python3 --enable-optimizations
此处make时候就会检测那些包是否存在
linux-9qk9:/tmp/software_download/Python-3.6.4 # make
0:14:48 load avg: 0.83 [389/406] test_winconsoleio
0:14:48 load avg: 0.83 [390/406] test_winreg -- test_winconsoleio skipped
0:14:49 load avg: 0.83 [391/406] test_winsound -- test_winreg skipped
0:14:49 load avg: 0.83 [392/406] test_with -- test_winsound skipped (resource denied)
0:14:49 load avg: 0.83 [393/406] test_wsgiref
0:14:50 load avg: 0.83 [394/406] test_xdrlib
0:14:50 load avg: 0.93 [395/406] test_xml_dom_minicompat
0:14:51 load avg: 0.93 [396/406] test_xml_etree
0:14:53 load avg: 0.93 [397/406] test_xml_etree_c
0:14:56 load avg: 0.93 [398/406] test_xmlrpc
0:14:59 load avg: 0.93 [399/406] test_xmlrpc_net
0:15:00 load avg: 0.93 [400/406] test_yield_from -- test_xmlrpc_net skipped (resource denied)
0:15:00 load avg: 0.94 [401/406] test_zipapp
0:15:01 load avg: 0.94 [402/406] test_zipfile
0:15:06 load avg: 0.94 [403/406] test_zipfile64
0:15:07 load avg: 0.94 [404/406] test_zipimport -- test_zipfile64 skipped (resource denied)
0:15:07 load avg: 0.94 [405/406] test_zipimport_support
0:15:09 load avg: 0.94 [406/406] test_zlib
test_zlib skipped 这里看到zlib有问题, 当然当中还有很多包是skipped的,自己认为有用的就去下载对应的包吧
linux-9qk9:/tmp/software_download/Python-3.6. # rpm -qi zlib
Name : zlib Relocations: (not relocatable)
Version : 1.2.7 Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
Release : 0.10.128 Build Date: Sat May ::
Install Date: Tue Jul :: Build Host: crick
Group : System/Libraries Source RPM: zlib-1.2.-0.10..src.rpm
Size : License: zlib license. See http://zlib.net/zlib_license.html
Signature : RSA/, Sat May :: , Key ID e3a5c360307e3d54
Packager : http://bugs.opensuse.org
URL : http://www.zlib.net/
Summary : Data Compression Library
Description :
ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt
(deflate format) and rfc1952.txt (gzip format). These documents are
also available in other formats from
ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html. Authors:
--------
Rob Hooft <hooft@EMBL-Heidelberg.DE>
Michael Mauldin <mlm@cs.cmu.edu>
Distribution: SUSE Linux Enterprise
linux-9qk9:/tmp/software_download/Python-3.6. #
linux-9qk9:/tmp/software_download/Python-3.6.4 # rpm -qi zlib-devel
package zlib-devel is not installed
我们看到zlib-devel 没有安装,根据上面的版本信息我们去下载一个rpm包后面的release信息即0.10.128可以不一样
linux-9qk9:/tmp/software_download # ls
Python-3.6.4 Python-3.6.4.tgz gnureadline-6.3.8.tar.gz setuptools-40.0.0.zip zlib-devel-1.2.7-3.14.x86_64.rpm
安装zlib-devel-1.2.7-3.14.x86_64.rpm
linux-9qk9:/tmp/software_download # rpm -ivh zlib-devel-1.2.7-3.14.x86_64.rpm
warning: zlib-devel-1.2.7-3.14.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 19c4ef64
Preparing... ########################################### [100%]
1:zlib-devel ########################################### [100%]
linux-9qk9:/tmp/software_download #
安装libopenssl-devel, 这个有点类似centos里面的openssl-devel包
linux-9qk9:/tmp/software_download # rpm -qi openssl
Name : openssl Relocations: (not relocatable)
Version : 0.9.8j Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
Release : 0.50.1 Build Date: Mon Mar 25 11:10:09 2013
Install Date: Tue Jul 10 09:41:57 2018 Build Host: acklins
Group : Productivity/Networking/Security Source RPM: openssl-0.9.8j-0.50.1.src.rpm
Size : 1182276 License: BSD 3-Clause
Signature : RSA/8, Mon Mar 25 11:10:24 2013, Key ID e3a5c360307e3d54
Packager : http://bugs.opensuse.org
URL : http://www.openssl.org/
Summary : Secure Sockets and Transport Layer Security
Description :
The OpenSSL Project is a collaborative effort to develop a robust,
commercial-grade, full-featured, and open source toolkit implementing
the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS
v1) protocols with full-strength cryptography. The project is managed
by a worldwide community of volunteers that use the Internet to
communicate, plan, and develop the OpenSSL toolkit and its related
documentation.
Derivation and License
OpenSSL is based on the excellent SSLeay library developed by Eric A.
Young and Tim J. Hudson. The OpenSSL toolkit is licensed under an
Apache-style license, which basically means that you are free to get it
and to use it for commercial and noncommercial purposes.
Please read the file /usr/share/doc/packages/openssl/README-FIPS.txt
for information on FIPS-140-2 compliant mode of operation of the
openssl shared libraries.
Authors:
--------
Mark J. Cox <mark@openssl.org>
Ralf S. Engelschall <rse@openssl.org>
Dr. Stephen Henson <steve@openssl.org>
Ben Laurie <ben@openssl.org>
Bodo Moeller <bodo@openssl.org>
Ulf Moeller <ulf@openssl.org>
Holger Reif <holger@openssl.org>
Paul C. Sutton <paul@openssl.org>
Distribution: SUSE Linux Enterprise 11
linux-9qk9:/tmp/software_download # rpm -ivh libopenssl-devel-0.9.8j-2.1.x86_64.rpm
warning: libopenssl-devel-0.9.8j-2.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 7af5fd64
Preparing... ########################################### [100%]
1:libopenssl-devel ########################################### [100%]
linux-9qk9:/tmp/software_download #
重新 make
linux-9qk9:/tmp/software_download # cd Python-3.6.4/
linux-9qk9:/tmp/software_download/Python-3.6.4 # make
可以看到zlib-devel安装后就不报错了
0:15:34 load avg: 0.96 [403/406] test_zipfile64
0:15:35 load avg: 0.96 [404/406] test_zipimport -- test_zipfile64 skipped (resource denied)
0:15:35 load avg: 0.96 [405/406] test_zipimport_support
0:15:37 load avg: 0.96 [406/406] test_zlib
Total duration: 15 min 39 sec
Tests result: FAILURE
随后正式安装make install,当然可以试试看zlib-devel不安装直接make install看看会报什么错误
linux-9qk9:/tmp/software_download/Python-3.6.4 # make install
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-9.0.1 setuptools-28.8.0
linux-9qk9:/tmp/software_download/Python-3.6.4 #
至此已经看到python3安装成功了,但是还有点擦屁股的事情要做
ps,如果安装了libopenssl-devel还是不行的话,我们就要去找一台已经import ssl不报错的机器比如下面那台机器,
将_ssl.cpython-36m-x86_64-linux-gnu.so复制到/usr/local/python3/lib/python3.6/lib-dynload目录下面就可以了
inspect01:/usr/local/python3/lib/python3.6/lib-dynload # ls *ssl*
_ssl.cpython-36m-x86_64-linux-gnu.so
inspect01:/usr/local/python3/lib/python3.6/lib-dynload #
--------------------------------------------------------------------------------------------------------------------------
首先要在.proile或者.bash_profile里面添加环境变量,不然Python3无法直接访问
linux-9qk9:/tmp/software_download/Python-3.6.4 # python3
If 'python3' is not a typo you can run the following command to lookup the package that contains the binary:
command-not-found python3
-bash: python3: command not found
我们新建立一个测试用户在测试用户里面添加环境变量
linux-9qk9:~ # useradd -m test
linux-9qk9:~ # ls /home/test/
.bash_history .bashrc .emacs .fonts .gnu-emacs .inputrc .mozilla .muttrc .profile .vimrc .xim.template .xinitrc.template bin
linux-9qk9:~ # su - test
test@linux-9qk9:~> view .profile
在.profile文件里面添加一行
PATH=$PATH:/usr/local/python3/bin
:wq! //保存退出命令
test@linux-9qk9:~> . .profile //激活新添加的PATH
输入python3可以看到已经可以启动python3了
test@linux-9qk9:~> python3
Python 3.6.4 (default, Jul 11 2018, 01:24:13)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "/etc/pythonstart", line 7, in <module>
import readline
ModuleNotFoundError: No module named 'readline'
>>>
我们看到上面有个报错No module named 'readline',接下来我们来解决下
Traceback (most recent call last):
File "/etc/pythonstart", line 7, in <module>
import readline
ModuleNotFoundError: No module named 'readline'
>>> exit() //输入exit()退出Python3
test@linux-9qk9:~> su - //切换到root
Password:
linux-9qk9:~ # cd /tmp/software_download/
linux-9qk9:/tmp/software_download # ls
Python-3.6.4 Python-3.6.4.tgz gnureadline-6.3.8.tar.gz setuptools-40.0.0.zip zlib-devel-1.2.7-3.14.x86_64.rpm
到https://pypi.org/下载 gnureadline-6.3.8.tar.gz,
千万不要下载readline-6.2.4.1.tar.gz,这个包官方文档说了已经失效了,原话如下
WARNING: THIS PACKAGE IS DEPRECATED! It has been renamed to GNUREADLINE to resolve a name clash with the standard library module. The new PyPI page is here.
linux-9qk9:/tmp/software_download # tar -zxvf gnureadline-6.3.8.tar.gz
为root用户设置python3的PATH
linux-9qk9:~ # view /etc/profile
在最后一行添加 PATH=$PATH:/usr/local/python3/bin 随后wq!保存退出
401 case "$-" in
402 *i*)
403 if test "$TERM" = "xterm" -a -O "$tty" ; then
404 if test -z "${SSH_TTY}" ; then
405 test ! -f $HOME/.hushlogin -a -s /etc/motd && cat /etc/motd
406 echo "Directory: $PWD"
407 # Last but not least
408 date
409 fi
410 #
411 # shadow passwd
412 # Note: on normal console this will be done by /bin/login
413 #if test -r /var/log/faillog ; then
414 # test -x /bin/faillog && /bin/faillog
415 # test -x /usr/sbin/faillog && /usr/sbin/faillog
416 #fi
417 fi
418 esac
419 PATH=$PATH:/usr/local/python3/bin
420 #
421 # End of /etc/profile
422 #
随后执行. /etc/profile使环境变量生效
linux-9qk9:/tmp/software_download # . /etc/profile
linux-9qk9:/tmp/software_download #
linux-9qk9:/tmp/software_download # python3
Python 3.6.4 (default, Jul 11 2018, 01:24:13)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "/etc/pythonstart", line 7, in <module>
import readline
ModuleNotFoundError: No module named 'readline'
>>> exit()
linux-9qk9:/tmp/software_download #
执行python3 setup.py install进行安装
linux-9qk9:/tmp/software_download/gnureadline-6.3.8 # python3 setup.py install
安装完成后再次输入python3可以看到No module named 'readline'报错消失
linux-9qk9:/tmp/software_download/gnureadline-6.3.8 # python3
Python 3.6.4 (default, Jul 11 2018, 01:24:13)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>exit()
接下来我们搭建一个虚拟环境,网上有很多Python 虚拟环境 pyenv、venv(pyvenv)、virtualenv之间的区别 可以参考下 https://www.cnblogs.com/qinhan/p/9293126.html
由于我们使用的是3.6的Python版本,直接一条命令
test@linux-9qk9:~> python3 -m venv aa/bb //创建虚拟环境
test@linux-9qk9:~> cd aa/bb
test@linux-9qk9:~/aa/bb> ls
bin include lib lib64 pyvenv.cfg //可以看到虚拟环境创建成功
test@linux-9qk9:~/aa/bb>
test@linux-9qk9:~/aa/bb> source bin/activate //激活虚拟环境
(bb) test@linux-9qk9:~/aa/bb>
今后可以在虚拟环境下进行安装软件以及编译程序等,至此python3安装结束
suse11 安装 python3.6 python3 安装步骤的更多相关文章
- win10 anaconda3 python3.6安装tensorflow keras tensorflow_federated详细步骤及在jupyter notebook运行指定的conda虚拟环境
本文链接:https://blog.csdn.net/weixin_44290661/article/details/1026789071. 安装tensorflow keras tensorflow ...
- Ubuntu16.04下安装python3.6.4详细步骤
记录一下: Ubuntu16.04自带的python版本为python2.7和python3.5,现在想要安装python3.6.4,注意:系统自带的python版本别删除 步骤: # 官网下载安装包 ...
- centos 7 安装 python3.6 python3 安装步骤以及pip pip3安装挂载
首先去python官网下载python3的源码包,网址:https://www.python.org/ 或者直接wget下载 wget https://www.python.org/ftp/pytho ...
- python3.6.3安装步骤,适用linux centos系统
step1: yum -y install gccyum install zlib zlib-devel step2: cd /usr/bin/ mv python python.bak step3: ...
- Windows下安装python2和python3双版本
现在大家常用的桌面操作系统有:Windows.Mac OS.ubuntu,其中Mac OS 和 ubuntu上都会自带python.这里我们只介绍下Windows(我用的Win10)环境下的pytho ...
- 在同一台电脑上同时安装Python2和Python3
目前Python的两个版本Python2和Python3同时存在,且这两个版本同时在更新与维护. 到底是选择Python2还是选择Python3,取决于当前要使用的库.框架支持哪个版本. 例如:HTM ...
- 在Python3.5下安装和测试Scrapy爬网站
1. 引言 Scrapy框架结构清晰,基于twisted的异步架构可以充分利用计算机资源,是爬虫做大的必备基础.本文将讲解如何快速安装此框架并使用起来. 2. 安装Twisted 2.1 同安装Lxm ...
- python3.5 默认安装路径 | 安装 | 删除
win7 环境下: Python3.5默认安装路径是当前用户的 AppData\.. 下 这么做的一个可能原因是 现在安装过程中默认是install just for me,这个会把python默认 ...
- Mac同时安装python2和python3
Mac同时安装python2和python3 Mac自带python2,但因为开发时所用但pythonkennel是3也可能是2,并且就算是python2,版本号也许和内置但python也有所不同.所 ...
随机推荐
- (1234队)NABCD分析
1.N(需求) 我们通过平常上自习时发现的问题和在校调查发现人们在寻找空教室上自习时会遇到诸多问题,其中 问题一:找不到空教室:5% 问题二:非上课教室学生太多:70% 问题三:有占座情况:20% 问 ...
- C语言典型编程2
关于C的一些小而精的编程,适合希望提升编程能力的初学者学习:关键编程也就几句,但思维可以迁移到其他编程语言.同一问题,算法多种. //任意整数的任意次方取后3位(算数取位)#include<st ...
- Linux-01
Linux各目录的作用 /bin/ 存放系统命令的目录,普通用户和超级用户都可以执行.不过放在/bin下的命令在单用户模式下也可以执行 /sbin/ 保存和系统环境设置相关的命令,只有超级用户可以使用 ...
- 原型设计工具—Axure
作为软件设计的一员,需要在软件开发初期确保软件的具体内容,防止后期大幅度的修改. 在这样的情况下,原型设计软件就起到了关键的作用. 摘要: 原型设计为什么这么重要呢? 因为它帮助我们搭建了低保真或高保 ...
- Java 数据类型与运算符
JAVA数据类型分基本(内置)数据类型和引用数据类型. 区别: 基本数据类型在被创建时,在栈上给其划分一块内存,将数值直接存储在栈上. 引用数据类型在被创建时,首先要在栈上给其引用(句柄)分配一块内存 ...
- 理解javascript中的立即执行函数(function(){})()
之前看了好多代码,都有用到这种函数的写法,但是都没认真的去想为什么会这样写,今天开始想学习下jquery的源码,发现jquery也是使用这种方式,用(function(window, undefine ...
- laravel -查询近7月走势图案例
// 获取7月前的时间$time = date('Y-m',strtotime("-0 year -7 month -0 day" ));$where['created_at'] ...
- gem 安装问题
错误提示: ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) SSL_connect returned=1 errno=0 ...
- Win10下windows mobile设备中心连接不上的方法无法启动
微软Win10自动更细补丁后windows mobile设备中心就无法启动了 需要重新启动相关的服务并授予 本机登录用户 权限 1.点击屏幕左下角“开始”图标,点击“运行”,在弹出的输入框中输入“se ...
- 如何修改PCB后更新到原理图(以AD为例)
实际绘图过程中会有多种情况发生,例如根据以前的项目做修改应用于新的项目.只有PCB没有原理图....... 如何通过修改PCB后更新到原理图(主要在PCB中增加元器件以及添加网络标号进行连线后更新到原 ...