|
|
第1行: |
第1行: |
| =install python3.x 2021=
| |
| 最好不要手工 要批量如ansible
| |
|
| |
| [[Ansible基础#ansible配合shell脚本批量编译安装python3.7]]
| |
| <pre>
| |
|
| |
| #2021
| |
|
| |
| #abord 小写的o字母
| |
|
| |
| yum install -y zlib-devel
| |
| curl -o py.tgz https://www.python.org/ftp/python/3.7.7/Python-3.7.7.tgz
| |
| #国内mirrors
| |
| curl -o py.tgz https://mirrors.huaweicloud.com/python/3.7.8/Python-3.7.8.tgz
| |
|
| |
|
| |
|
| |
|
| |
| #!/bin/bash
| |
| # install python3.7.12
| |
| # yum tools
| |
|
| |
| yum -y groupinstall "Development tools"
| |
| 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
| |
| cd /usr/local/src
| |
| mkdir /usr/local/python37
| |
| tar -xvf Python-3.7.12.tar.xz
| |
| cd Python-3.7.12
| |
| ./configure --prefix=/usr/local/python37
| |
| make -j3 && make install
| |
| mv /usr/bin/python3 /usr/bin/python3bak
| |
| mv /usr/bin/pip3 /usr/bin/pip3bak
| |
| ln -s /usr/local/python37/bin/python3 /usr/bin/python3
| |
| ln -s /usr/local/python37/bin/pip3 /usr/bin/pip3
| |
| # end
| |
|
| |
|
| |
|
| |
| 注意
| |
| ARNING: You are using pip version 20.1.1; however, version 21.2.4 is available.
| |
| You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
| |
| root@myxps:
| |
| </pre>
| |
| ==比较老的 ==
| |
| <pre>
| |
|
| |
| yum -y groupinstall "Development tools"
| |
|
| |
| 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
| |
|
| |
|
| |
| wget -c https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
| |
| 21 tar xvf Python-3.5.1.tgz
| |
| 23 cd Python-3.5.1/
| |
|
| |
| 25 ./config
| |
| 26 ./configure
| |
| 27 ./configure --prefix=/usr/local/python3
| |
| 28 make -j4 && make install
| |
|
| |
| 创建Python3,pip3的软链接
| |
| ln -s /usr/local/python3/bin/python3.5 /usr/bin/python3
| |
| 78 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
| |
|
| |
|
| |
|
| |
|
| |
| #abord 小写的o字母
| |
|
| |
| yum install -y zlib-devel
| |
| curl -o py.tgz https://www.python.org/ftp/python/3.7.7/Python-3.7.7.tgz
| |
| #国内mirrors
| |
| curl -o py.tgz https://mirrors.huaweicloud.com/python/3.7.8/Python-3.7.8.tgz
| |
| tar xvf py.tgz && cd Python-3.7.7/
| |
| ./configure --prefix=/usr/local/python3
| |
| make -j4 && make install
| |
| ln -s /usr/local/python3/bin/python3 /usr/bin/python3
| |
|
| |
|
| |
| </pre>
| |
|
| |
| =numpy=
| |
| <pre> | | <pre> |
| pip install numpy
| | centos 7启动方式 |
| #利用ansible 批量和国内源
| |
| ansible intra -b -u root -a "pip3 install numpy scipy matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple"
| |
|
| |
|
|
| |
|
| | centos6使用的是/etc/rc.d/init.d/functions启动centos7使用的是systemd启动 |
| | systemd启动脚本方式 |
| | systemctl enable httpd.service #自启动某服务 |
| | systemctl disable httpd.service #禁用开机启动 |
| | systemctl status httpd.service #查看服务状态 |
| | systemctl list-units --type=service #查看所有服务 |
| | |
| | systemctl start httpd.service |
| | systemctl stop httpd.service |
| | systemctl restart httpd.service |
| | |
| | systemctl is-enabled httpd #直看httpd服务是否开机启动 |
| | |
| | 也可以用于管理系统重启系统 |
| | systemctl reboot关闭系统 |
| | systemctl poweroffCPU停止工作systemctl halt暂停系统 |
| | systemcti suspend休眠 |
| | systemctl hibernate进入救援模式-单用模式systemctl rescue |
|
| |
|
| python3
| |
| Python 3.7.12 (default, Sep 23 2021, 03:26:32)
| |
| [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
| |
| Type "help", "copyright", "credits" or "license" for more information.
| |
| >>> import numpy
| |
| >>> from numpy import *
| |
| >>> eye(4)
| |
| array([[1., 0., 0., 0.],
| |
| [0., 1., 0., 0.],
| |
| [0., 0., 1., 0.],
| |
| [0., 0., 0., 1.]])
| |
| >>>
| |
| </pre> | | </pre> |
| https://numpy.org/install/
| |
|
| |
| =python源码国内下载=
| |
|
| |
| https://mirrors.huaweicloud.com/python
| |
|
| |
| =troubleshooting=
| |
|
| |
| zipimport.ZipImportError: can't decompress data; zlib not available
| |
|
| |
| 安装上所有的lib 用上面的安装方式就行了
| |
|
| |
| Segmentation fault
| |
|
| |
| sudo apt install gcc-10
| |
| CC=gcc-10 pyenv install 3.6.13
| |
|
| |
| =see also=
| |
| [https://segmentfault.com/a/1190000015628625 CentOS 7 下 安装 Python3.7]
| |
|
| |
|
| [https://www.runoob.com/numpy/numpy-install.html NumPy 安装] | | [[Nginx on centos7]] |
|
| |
|
| [https://www.jianshu.com/p/aca9967a7136 Centos7 Python3 pip3下安装scrapy] | | [[Centos7初始化]] |
| [[category:python]]
| | [[category:linux]][[category:ops]] |