栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

python升级版本命令-python版本升级及pip部署方法

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

python升级版本命令-python版本升级及pip部署方法

标签:

Python版本升级

CentOS 6.3自带的Python版本为2.6,首先需要升级到2.7版本。由于旧版本的Python已被深度依赖,所以不能卸载原有的Python,只能全新安装。

1.下载Python-2.7.4.tgz

wget http://python.org/ftp/python/2.7.4/Python-2.7.4.tgz

2. 解压安装,命令如下:

1 tar -xvf Python-2.7.4.tgz2 cd Python-2.7.4

3 ./configure --prefix=/usr/local/python2.7

4 make5 make install

3. 创建链接来使系统默认python变为python2.7

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

4. 查看Python版本

python –V

5. 修改yum配置(否则yum无法正常运行)

vim /usr/bin/yum

将第一行的#!/usr/bin/python修改为系统原有的python版本地址#!/usr/bin/python2.6

至此CentOS6.3系统Python已成功升级至2.7.4版本

安装pip

Pip是一个安装和管理python包的工具。

安装方法如下:

2. 执行安装命令

python get-pip.py

3. 创建连接(否则会报错提示“命令不存在”)

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

测试:

pip install redis

Collecting redis

/usr/local/python2.7/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.

InsecurePlatformWarning

Downloading redis-2.10.5-py2.py3-none-any.whl (60kB)

100% |################################| 61kB 759kB/s

Installing collected packages: redis

Successfully installed redis-2.10.5

至此pip安装完成!

如果安装pip时报如下错误:ImportError: cannot import name HTTPSHandle

执行 yum install sqlite-devel

标签:

原文地址:http://www.cnblogs.com/saneri/p/5111273.html

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/834013.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号