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 2016-07-29 07:50  yingchen  阅读(354)  评论(0编辑  收藏  举报

导航