linux下安装python

 

在Linux下安装Python的操作相当简单,按如下步骤操作即可:

 

命令:

wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
tar xf Python-3.5.2.tgz


1、在官方网站下载python安装包,这里注意python.org/download路径被屏蔽,需要使用http://www.python.org/页面上的中文“下载”链接进行下载。

这里下载了python最新的3.2.2版本:Python-3.2.2.tgz

下载后,文件目录在/home/python/下,这也是我python的安装目录


2、解压:

[root@www python]# tar zxvf    Python-3.2.2.tgz


3、打开安装目录,执行:

[root@www python]# cd Python-3.2.2

[root@www Python-3.2.2]#./configure

[root@www Python-3.2.2]# make

[root@www Python-3.2.2]# make  install

值此,安装完成。


4、但此时输入”python”命令,仍然显示是旧版本的,这就需要创建软连接:

[root@www bin]# cd /usr/bin

[root@www bin]# ll |grep python

[root@www bin]# rm -rf python

[root@www bin]# ln -s /home/python/Python-3.2.2/python python

[root@www bin]# python

Python 3.2.2 (default, Oct 26 2011, 23:40:16)

[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2

Type "help", "copyright", "credits" or"license" for more information.

 

在后续使用pip3的命令时,报错  -su: pip3: command not found

请使用以下几种方式解决:

One of three things will likely fix it:

1. In case python3-pip did not install correctly, re-install it:

sudo apt-get remove python3-pip; sudo apt-get install python3-pip`

2. Try using the command python3-pip instead (works on Fedora; I don't have a copy of Kubuntu to try it on)

3. Just a wild guess...check pip --version. There is a slight possibility that after installing python3-pip the new pip would replace the old pip (perhaps via alternatives?)

posted on   yingchen  阅读(362)  评论(0编辑  收藏  举报

编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示