运维笔记--linux环境提示python: command not found
场景描述:
新部署的容器环境,终端执行python命令,提示没有该命令。
从报错异常可以看出,可能是python环境未安装。
分析思路:
检查python路径:
方式一:type -a python
方式二:
ls -l /usr/bin/python
ls -l /usr/bin/python*
方式三:
which python
如果输出空或者no such file or directory, 则说明未安装。
处理过程:
不同Linux系统版本安装方式不同!
Ubuntu/Debian/Mint Linux install Python
安装python2
$ sudo apt-get install python
安装python3
$ sudo apt-get install python3
Oracle/RHEL (Red Hat)/CentOS Linux install Python
$ sudo yum install python
Fedora Linux install Python
python2: $ sudo dnf install python
python3: $ sudo dnf install python3
MacOS X Unix install Python3
Type the following command:$ brew install python3
Arch Linux install Python
python2: $ sudo pacman -S python2
python3:$ sudo pacman -S python3
FreeBSD Unix install Python
Type the following pkg command to add the Python v2.x:# pkg install python2
OR To install the Python v2.x port:# cd /usr/ports/lang/python2/ && make install clean
To add the Python v3.x package:# pkg install python3
OR To install the Python v3.x port:# cd /usr/ports/lang/python3/ && make install clean
OpenBSD Unix install Python
Type the following pkg_add command to add the Python v2.x or 3.x:# pkg_add python
OR$ doas pkg_add python
如果需要创建软链接:
A note about broken symlink
Sometimes a soft link to Pythons’s executables is broken for some reason. For example, /usr/bin/python3.4 is real executables. You can point /usr/bin/python to /usr/bin/python3.4 for Python version 3.4 using the ln command:$ sudo ln -s /usr/bin/python3.4 /usr/bin/python
Now you can run program:$ python mycode.py
参考:https://www.cyberciti.biz/faq/bash-python-command-not-found/
运维笔记--linux环境提示python: command not found的更多相关文章
- 运维笔记--linux下忘记mysql root密码
补充链接:Windows下忘记密码处理: https://www.cnblogs.com/hellojesson/p/5972950.html 场景描述: Linux环境下忘记 root 密码, 1. ...
- 运维笔记--Docker环境ubuntu系统安装指定版本python[3.6]
场景描述: 直接安装出现如下异常: root@ae2d02e458f3:/home# apt-get install python3.6 Reading package lists... Done B ...
- 运维笔记--Linux查找指定目录下包含某字符串的文件
待整理: 参考:http://blog.sina.com.cn/s/blog_53d496960102xg5c.html 例: find /home/logstash/ -type f | xargs ...
- 运维笔记--Linux查找指定目录下某段时间的文件
查找指定目录下,60天之前的文件:find /mnt/xml_data -mtime +60 -name "*.xml" 找到并统计数量:find /mnt/xml_data -m ...
- Linux系统运维笔记(二),Linux文件编辑命令
Linux系统运维笔记 Linux文件编辑命令 首先我们使用命令 vi filename 打开一个文件,这个时候进入到的是命令模式 接下来我们按i,然后键盘随便输入写内容. 然后按ESC重新进入到命令 ...
- Linux系统运维笔记(五),CentOS 6.4安装java程序
Linux系统运维笔记(五),CentOS 6.4安装java程序 用eclipse编译通的java程序,现需要实施到服务器.实施步骤: 一,导出程序成jar包. 1,在主类编辑界面点右健,选 ru ...
- Linux系统运维笔记(四),CentOS 6.4安装 MongoDB
Linux系统运维笔记(四),CentOS 6.4安装 MongoDB 1,下载 https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.6 ...
- Linux系统运维笔记(四),CentOS 6.4安装Nginx
Linux系统运维笔记(四),CentOS 6.4安装Nginx 1,安装编译工具及库文件 yum -y install make zlib zlib-devel gcc-c++ libtool op ...
- Linux系统运维笔记(三),设置IP和DNS
Linux系统运维笔记(三),设置IP和DNS 手工配置静态的IP地址 也就是手工配置IP地址.子网掩码.网关和DNS. vi /etc/sysconfig/network-scripts/ifcfg ...
随机推荐
- Gradle 使用教程之 Task 详解
最近打算学习下 gradle 在 Android 中的使用,结果百度出来的文章都是介绍性文章,没啥干货.后来找到 gradle 官网教程,自己对着撸. Gradle 概述: Gradle 是一个基于 ...
- easyui dialog 设置弹窗位于页面中间
原文链接:https://my.oschina.net/jingyao/blog/776603 此方法为解决页面含有滚动条时,弹窗位置错误问题,此方法可将带滚动条页面中弹窗显示于页面中间. $(&qu ...
- 我理解的Linux内存管理
众所周知,内存管理是Linux内核中最基础,也是相当重要的部分.理解相关原理,不管是对内存的理解,还是对大家写用户态代码都很有帮助.很多书上.很多文章都写了相关内容,但个人总觉得内容太复杂,不是太容易 ...
- NumPy的Linalg线性代数库探究
1.矩阵的行列式 from numpy import * A=mat([[1,2,4,5,7],[9,12,11,8,2],[6,4,3,2,1],[9,1,3,4,5],[0,2,3,4,1]]) ...
- Array.Sort(valuesArry);
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cons ...
- Markdown 设置字体大小颜色及背景色
一.更改字体.大小.颜色 <font face="黑体">我是黑体字</font><font face="微软雅黑">我是微 ...
- 转成p进制算法C语言
今天打比赛的时候竟然下一没有想起来, 实际上是非常简单的. 举例说明: $64 = 2 \times 3^3 + 1 \times 3^2 + 3^0$ 根据秦九韶算法每次提出3,即 $3(2 \ti ...
- LeetCode 873. Length of Longest Fibonacci Subsequence
原题链接在这里:https://leetcode.com/problems/length-of-longest-fibonacci-subsequence/ 题目: A sequence X_1, X ...
- jsp之大文件分段上传、断点续传
1,项目调研 因为需要研究下断点上传的问题.找了很久终于找到一个比较好的项目. 在GoogleCode上面,代码弄下来超级不方便,还是配置hosts才好,把代码重新上传到了github上面. http ...
- learning java transient 自定义序例化
public class Person implements java.io.Serializable { private String name; private transient int age ...