运维笔记--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 ...
随机推荐
- Zabbix Documentation 4.0
Zabbix Documentation 4.0 1 Create user account For all of the Zabbix daemon processes, an unprivileg ...
- nodejs express+nodemon 实现自动刷新 (热更新)
1.全局安装 nodemon npm i nodemon -g -f 2. 在项目中安装nodemon npm i nodemon -f 3.使用nodemon 在express项目中 运行nodem ...
- Linux命令——jobs、bg、fg、nohup
参考:Bash基础——工作管理(Job control) jobs -l :除了列出 job number 与命令串之外,同时列出 PID 的号码: -r :仅列出正在背景 run 的工作:-s :仅 ...
- Hoax or what UVA - 11136(multiset的应用)
刚开始把题意理解错了,结果样例没过,后来发现每天只处理最大和最小的,其余的不管,也就是说昨天的元素会影响今天的最大值和最小值,如果模拟的话明显会超时,故用multiset,另外发现rbegin()的功 ...
- 在markdown中插入github仓库中的图片
右击github中的图片,获得链接: https://github.com/nxf75/ML_Library/blob/master/Hadoop/Haddop%E6%A1%86%E6%9E%B6.p ...
- 基于springboot2.x集成缓存注解及设置过期时间
添加以下配置信息: /** * 基于注解添加缓存 */ @Configuration @EnableCaching public class CacheConfig extends CachingCo ...
- python写入excel(方式1)
import xlsxwriter li=["张三","李四","王五","周六","王琪",&qu ...
- 写一段程序,删除字符串a中包含的字符串b,举例 输入a = "asdw",b = "sd" 返回 字符串 “aw”;一个容易被忽略的bug
代码如下: public class test{ public static void main(String args[]){ String test=test("sahsjkshabsh ...
- 上下左右居中 无固定高的div
<style type=“text/css”> #vc { display:table; background-color:#C2300B; width:500px; height:200 ...
- 分享STM32 FLASH 擦除(以及防止误擦除程序代码)、写入
编译环境:我用的是(Keil)MDK4.7.2 stm32库版本:我用的是3.5.0一.本文不对FLASH的基础知识做详细的介绍,不懂得地方请查阅有关资料. 对STM32 内部FLASH进行编程操 ...