Linux下升级python和安装pip的详解
作者:小飞侠-2 时间:2022-08-23 06:27:15
Linux版本升级:
1、首先确认Linux操作系统中自带的python 版本时候与自己所需要的版本一致
所有的python版本都在https://www.python.org/ftp/python/ 选择下载
2、 wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz 进行下载
3、解压
tar -zxvf Python-2.7.11.tgz
进入Python-2.7.11目录 输入
./configure
make
make install
4、此时查看python版本还是系统默认的版本
执行:
mv /usr/bin/python /usr/bin/python2.6
ln -s /usr/local/bin/python2.7 /usr/bin/python
再次查看已经更新到你要安装的版本
Pip 安装
1、在python中提供了一个get-pip.py;下面是地址
https://bootstrap.pypa.io/get-pip.py
2、在Linux下执行curl https://bootstrap.pypa.io/get-pip.py | python 进行下载安装
这样很方便了 想装什么包就装什么包
Pip install xxx
注意:升级完python版本注意,可能你的yum命令不能使用,因为yum命令使用python写的
# vi /usr/bin/yum#打开yum命令文件,更改第一行脚本启动地址
改成上面 步骤4中的 /usr/bin/python2.6 就ok
补充Windows下安装pip:
快捷方法:
找到 C:\Python27\Scripts 目录:直接运行 easy_install.exe pip
就搞定了 安装pip
pip升级:
我们在使用pip安装模块的时候,有些时候会出现pip版本过低的情况
一条命令解决:
python -m pip install -U pip
linux和Windows都支持这命令
来源:https://blog.csdn.net/qq_26562641/article/details/72875040
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
详解Golang语言HTTP客户端实践
Python设计足球联赛赛程表程序的思路与简单实现示例
![](https://img.aspxhome.com/file/2023/3/89333_0s.png)
用Python将Excel数据导入到SQL Server的例子
Python requests库用法实例详解
python-try-except:pass的用法及说明
python基于 Web 实现 m3u8 视频播放的实例
Python使用海龟绘图实现贪吃蛇游戏
python爬取网页版QQ空间,生成各类图表
![](https://img.aspxhome.com/file/2023/5/69025_0s.png)
python实现学生管理系统源码
![](https://img.aspxhome.com/file/2023/9/62919_0s.jpg)
Python selenium get_cookies获取cookie不全的解决方案
![](https://img.aspxhome.com/file/2023/9/103499_0s.jpg)
Python 中@lazyprop 装饰器的用法
pytorch_pretrained_bert如何将tensorflow模型转化为pytorch模型
![](https://img.aspxhome.com/file/2023/0/88850_0s.png)
pandas值替换方法
Python sklearn预测评估指标混淆矩阵计算示例详解
![](https://img.aspxhome.com/file/2023/7/71437_0s.jpg)
OpenCV 边缘检测
![](https://img.aspxhome.com/file/2023/0/92120_0s.jpg)
Python3.6 之后字典是有序的?
![](https://img.aspxhome.com/file/2023/3/95283_0s.png)
Monster for Chrome
![](https://img.aspxhome.com/file/UploadPic/20105/4/monsterui-64s.png)
简单的水果风暴的算法过程
Python之tkinter组合框Combobox用法及说明
![](https://img.aspxhome.com/file/2023/4/95854_0s.gif)
Python编程应用设计原则详解
![](https://img.aspxhome.com/file/2023/6/107076_0s.jpg)