CentOS 6.6自带的是Python 2.6.6,而编译llvm需要Python 2.7以上。

checking for python... /usr/bin/python
checking for python >= 2.7... not found
configure: error: found python 2.6.6 (/usr/bin/python); required >= 2.7

yum中最新的也是Python 2.6.6,只能下载Python 2.7.9的源代码自己编译安装。

操作步骤如下:

1)安装devtoolset

yum groupinstall "Development tools"

2)安装编译Python需要的包包

yum install zlib-devel
yum install bzip2-devel
yum install openssl-devel
yum install ncurses-devel
yum install sqlite-devel

3)下载并解压Python 2.7.9的源代码

cd /opt
wget --no-check-certificate https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz
tar xf Python-2.7.9.tar.xz
cd Python-2.7.9

4)编译与安装Python 2.7.9

./configure --prefix=/usr/local
make && make altinstall

5)将python命令指向Python 2.7.9

ln -s /usr/local/bin/python2.7 /usr/local/bin/python

6)检查Python版本

sh
sh-4.1# python -V
Python 2.7.9
7)如果运行python还是原来的老版本的话,可以参考linux设置环境变量

python清空文件夹下log文件

#!/usr/bin/python import os import sys files_list = [] def print_files(path): lsdir = os.listdir(path) dirs = [i for i in lsdir if os.path...

阅读全文

python paramiko(SFTP) 相关文档

python paramiko SFTP文档地址: http://docs.paramiko.org/en/2.4/api/sftp.html import paramiko host = "THEHOST.com" #...

阅读全文

python 执行cmd命令并获取pid

process = subprocess.Popen('cmd命令') pid = process.pid print(pid)

阅读全文

欢迎留言