源码安装python及paramikon的初步试用
Auth: jin
Date: 20140314
OS:
CentOS release 5.5 (Final)
默认2.4版本
莫
1.download
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
2.install python
tar -zxvf Python-2.7.6.tgz && cd Python-2.7.6
./configure --prefix=/usr/local/python27/
make && make install
PIPY
wget https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz
由于下载pip是基于https协议的,故需要在wget url后面加上--no-check-certificate,否则不能下载:
tar -zxvf pip-1.5.4.tar.gz && cd pip-1.5.4
[root@ZJ-mnt-host-1 pip-1.5.4]# /usr/local/python27/bin/python setup.py build
Traceback (most recent call last):
File "setup.py", line 6, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools
3.install setuptools
wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg --no-check-certificate
# chmod +x setuptools-0.6c11-py2.7.egg
# sh setuptools-0.6c11-py2.7.egg
setuptools-0.6c11-py2.7.egg: line 3: exec: python2.7: not found
ln -s /usr/local/python27/bin/python2.7 /usr/bin/python2.7
# sh setuptools-0.6c11-py2.7.egg
Processing setuptools-0.6c11-py2.7.egg
Copying setuptools-0.6c11-py2.7.egg to /usr/local/python27/lib/python2.7/site-packages
Adding setuptools 0.6c11 to easy-install.pth file
Installing easy_install script to /usr/local/python27/bin
Installing easy_install-2.7 script to /usr/local/python27/bin
Installed /usr/local/python27/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11
4.install pyp
#cd pip-1.5.4
/usr/local/python27/bin/python setup.py build
/usr/local/python27/bin/python setup.py install
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying pip.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pip.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pip.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pip.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pip.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pip.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pip.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
creating dist
creating 'dist/pip-1.5.4-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing pip-1.5.4-py2.7.egg
creating /usr/local/python27/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg
Extracting pip-1.5.4-py2.7.egg to /usr/local/python27/lib/python2.7/site-packages
Adding pip 1.5.4 to easy-install.pth file
Installing pip script to /usr/local/python27/bin
Installing pip2.7 script to /usr/local/python27/bin
Installing pip2 script to /usr/local/python27/bin
Installed /usr/local/python27/lib/python2.7/site-packages/pip-1.5.4-py2.7.egg
Processing dependencies for pip==1.5.4
Finished processing dependencies for pip==1.5.4
Successfully installed paramiko pycrypto ecdsa
Cleaning up...
5.通过pypi安装paramiko
pip search paramiko
pip install paramiko
6、代码
### ssh config
sship = '127.0.0.1'
sshport = 22
sshuser = 'jin'
sshpassword = 'passwd' def sshRemoteCMD():
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
client.connect(sship,sshport,sshuser,sshpassword)
except Exception,e:
print 'error %s' % e
else:
stdin, stdout, stderr = client.exec_command('/bin/hostname')
if stdout:
print "OutPut:%s" % stdout.readlines()
if stderr:
print "StdError:%s" % stderr.readlines()
finally:
client.close() if __name__ == '__main__':
sshRemoteCMD()
测试
OutPut:['linux-gzy1.site\n']
StdError:[]
包管理软件安装
1、opensuse
[root@MyOpenSUSE ~]# zypper install python-pip
(1/2) Installing: python-setuptools-0.9.8-3.1.2 ........................................................................[done]
Additional rpm output:
update-alternatives: using /usr/bin/easy_install-2.7 to provide /usr/bin/easy_install (easy_install) in auto mode
(2/2) Installing: python-pip-1.4.1-2.2.1 ...............................................................................[done]
Additional rpm output:
update-alternatives: using /usr/bin/pip-2.7 to provide /usr/bin/pip (pip) in auto mode
[root@MyOpenSUSE ~]# pip install paramiko
源码安装python及paramikon的初步试用的更多相关文章
- RHEL6从源码安装python及其他软件包
RHEL6从源码安装python及其他软件包 ## install ssl $ sudo yum install openssl-devel or: $ sudo apt-get install li ...
- Linux基础--------监控系统、进程管理、软件包管理-------free、dd、kill、 rpm、yum、源码安装python
作业一:1) 开启Linux系统前添加一块大小为15G的SCSI硬盘 2) 开启系统,右击桌面,打开终端 3) 为新加的硬盘分区,一个主分区大小为5G,剩余空间给扩展分区,在扩展分区上划分1个逻辑分区 ...
- 06 swap命令,进程管理,rmp命令与yum命令,源码安装python
作业一: 1)开启Linux系统前添加一块大小为15G的SCSI硬盘 2)开启系统,右击桌面,打开终端 3)为新加的硬盘分区,一个主分区大小为5G,剩余空间给扩展分区,在扩展分区上划分1个逻辑分区,大 ...
- 源码安装python +NGINX 的坎坷路 +uwsgi安装 部署django 的CRM项目
一.Nginx安装(基于ubuntu17.10 版本) 首先我们是基于源码安装,主要有如下步骤 1.安装依赖包 1.安装gcc g++的依赖库 sudo apt-get install build-e ...
- Cenos(6.6/7.1)下从源码安装Python+Django+uwsgi+nginx到写nginx的环境部署(一)
梳理下这几个的关系: centos是redhat的社区版操作系统. Python2.7.5是开发语言(centos6.5下自带的python是2.6.6版本,所以需要源码更新,而centos7.1下面 ...
- 源码安装python
编译安装新版本python 一般来说python是linux系统的标配,但是版本一般却很老,而系统上面的很多服务可能与老的python存在依赖关系,我们又不能直接卸载.所以一般,我们可以在一个单独的目 ...
- centos 源码安装python
一.准备环境 首先在官网下载想要的python对应版本http//www.python.org/downloads/source 下载tgz就可以了.文件有两种 1,Python-版本号.tgz(解压 ...
- linux源码安装python及pip和django
1安装编译工具 yum install zlib-devel bzip2-devel openssl-devel python-devel kernel-devel libffi-devel ncur ...
- linux上源码安装python
Linux安装Python2.7 以下例子基于python 2.7.9,其他版本同理.# 1.下载python# wget https://www.python.org/ftp/python/2.7. ...
随机推荐
- OGRECave [www]
OGRECave https://github.com/OGRECave
- c++ 引用的分析
在一般教材里面,我们会说引用是变量的别名,另外在 c++ primer 5里面说到引用的时候,说引用不是对象,不能对它进行取地址.但是我们来看看下面代码的分析: #include <iostre ...
- 2017多校第8场 HDU 6138 Fleet of the Eternal Throne 思维,暴力
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6138 题意:给了初始区间[-1,1],然后有一些操作,可以r加上一个数,l减掉一个数,或者同时操作,问 ...
- SQL利用Case When Then多条件判断SQL 语句
http://www.cnblogs.com/kevin2013/archive/2010/07/02/1769682.html SQL利用Case When Then多条件判断SQL ,用于sele ...
- leetcode 之Copy List with Random Pointer(23)
深拷贝一个链表,不同的是这个链表有个额外的随机指针.参考:http://blog.csdn.net/ljiabin/article/details/39054999 做法非常的巧妙,分成三步,一是新建 ...
- leetcode 之Swap Nodes in Pairs(21)
不允许通过值来交换,在更新指针时需要小心. ListNode *swapNodes(ListNode* head) { ListNode dummy(-); dummy.next = head; fo ...
- Restful Framework (二)
目录 一.认证 二.权限 三.限制访问频率 四.总结 一.认证(补充的一个点) 回到顶部 认证请求头 #!/usr/bin/env python # -*- coding:utf-8 -*- from ...
- %和format的区别
在python中字符串的格式化分为两种:%和format.那么我们在什么时候来使用它们呢?它们有什么区别呢? 举个例子:我们根据一个坐标来表示一个动作 #定义一个坐标 point = (250,250 ...
- redis之(十五)redis的集群中的哨兵角色
一:redis集群的哨兵的目的是什么?. (1)监控主redis和从redis数据库是否正常运行 (2)主redis出现故障,自动将其中一台从redis升级为主redis.将原先的主redis转变成从 ...
- zookeeper编程入门系列之zookeeper实现分布式进程监控和分布式共享锁(图文详解)
本博文的主要内容有 一.zookeeper编程入门系列之利用zookeeper的临时节点的特性来监控程序是否还在运行 二.zookeeper编程入门系列之zookeeper实现分布式进程监控 三. ...