码迷,mamicode.com
首页 > 编程语言 > 详细

linux安装python

时间:2021-02-08 12:04:26      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:color   text   pac   sel   ls -l   medium   ttext   opera   tree   

默认centos, unbtan都已经安装了python3版本,可以通过 whereis python来检查已经安装的版本。

root@hecs-x-medium-2-linux-20200619090653:/usr/bin# whereis python
python: /usr/bin/python3.8 /usr/bin/python3.8-config /usr/bin/python /usr/lib/python3.9 /usr/lib/python2.7 /usr/lib/python3.8 /etc/python3.8 /usr/local/lib/python3.8 /usr/include/python3.8
root@hecs-x-medium-2-linux-20200619090653:/usr/bin# whereis python3
python3: /usr/bin/python3.8 /usr/bin/python3.8-config /usr/bin/python3 /usr/lib/python3.9 /usr/lib/python3.8 /usr/lib/python3 /etc/python3.8 /etc/python3 /usr/local/lib/python3.8 /usr/include/python3.8 /usr/share/python3 /usr/share/man/man1/python3.1.gz
root@hecs-x-medium-2-linux-20200619090653:/usr/bin#

如果没有python的命令,可以通过修改和增加链接文件的方式来实现。

root@hecs-x-medium-2-linux-20200619090653:/usr/bin# cd /usr/bin/
root@hecs-x-medium-2-linux-20200619090653:/usr/bin# ls -l py*
-rwxr-xr-x 1 root root 7813 Mar 13 2020 py3clean
-rwxr-xr-x 1 root root 12120 Mar 13 2020 py3compile
lrwxrwxrwx 1 root root 31 Dec 12 17:23 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx 1 root root 8 Dec 12 17:23 pydoc3 -> pydoc3.8
-rwxr-xr-x 1 root root 79 Jul 28 2020 pydoc3.8
lrwxrwxrwx 1 root root 12 Dec 12 17:23 pygettext3 -> pygettext3.8
-rwxr-xr-x 1 root root 21535 Jul 28 2020 pygettext3.8
-rwxr-xr-x 1 root root 392 Apr 2 2020 pyhtmlizer3
-rwxr-xr-x 1 root root 372 Apr 6 2020 pyjwt3
lrwxrwxrwx 1 root root 11 Feb 6 21:19 python -> ./python3.8
lrwxrwxrwx 1 root root 9 Dec 12 17:23 python3 -> python3.8
-rwxr-xr-x 1 root root 5486352 Jul 28 2020 python3.8
lrwxrwxrwx 1 root root 33 Jul 28 2020 python3.8-config -> x86_64-linux-gnu-python3.8-config
lrwxrwxrwx 1 root root 16 Mar 13 2020 python3-config -> python3.8-config

如果没有安装,就用apt install python, apt install python3来安装

root@hecs-x-medium-2-linux-20200619090653:/usr/bin# apt install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting ‘python-is-python2‘ instead of ‘python‘
The following additional packages will be installed:
libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib python2 python2-minimal python2.7 python2.7-minimal
Suggested packages:
python2-doc python-tk python2.7-doc binfmt-support
The following NEW packages will be installed:
libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib python-is-python2 python2 python2-minimal python2.7 python2.7-minimal
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,803 kB of archives.
After this operation, 16.4 MB of additional disk space will be used.
Do you want to continue? [Y/n]

 

root@hecs-x-medium-2-linux-20200619090653:/usr/bin# apt install python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3 is already the newest version (3.8.2-0ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

linux安装python

标签:color   text   pac   sel   ls -l   medium   ttext   opera   tree   

原文地址:https://www.cnblogs.com/wbwj/p/14383072.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!