simple method:  sudo easy_install pip

      you have done!and can install the other py programs using pip

eg.  sudo pip install openpyxl

the other method:    open  https://pip.pypa.io/en/stable/installing/

know that https://bootstrap.pypa.io/get-pip.py is the url of pip file

console: curl https://bootstrap.pypa.io/get-pip.py > get-pip.py

console: sudo python get-pip.py

done!

在脚本中判断是否安装某模块

if sys.modules.get('openpyxl') is not None:

import openpyxl

else:

  xxxx

在脚本中执行控制台命令

os.system('sudo easy_install pip')

os.system("echo 'value=0' > /tmp/test/testmodule.py") #将testmodule.py中的代码改为"value = 0"

install pip(mac)的更多相关文章

  1. 【pip】brew install pip 问题

    Mac 下用 brew install pip 命令安装 pip 时报错: Error: No available formula with the name "pip" Home ...

  2. ubuntu18.04 install pip

    1. environment release version: bionic kernel version:4.15.0-29-generic 2.install pip 2.1 sudo apt-g ...

  3. install pip 回顾

    在install pip的时候遇到如下问题 1. yum install 想安装一个package 总是提示没有package 可以安装. 但是后来可以了 2. make 和 configure 到底 ...

  4. yum -y install pip No package pip available. Error: Nothing to do

    centos下安装pip时失败: [root@wfm ~]# yum -y install pipLoaded plugins: fastestmirror, refresh-packagekit, ...

  5. 【QT】qt python install pip

    https://pip.pypa.io/en/stable/installing/ http://www.runoob.com/w3cnote/python-pip-install-usage.htm ...

  6. 第七篇、Nginx Install On Mac

    方式一: 在mac上安装nginx,依次安装对应的依赖 pcre ./configure --prefix=/usr/local/pcre-8.37 --libdir=/usr/local/lib/p ...

  7. ubuntu install pip

    ubuntu 安装pip sudo apt-get update sudo apt-get upgrade sudo apt-get install python-pip

  8. ubuntu不能安装pip unable to install pip in unbuntu

    要用python中模拟用户信息,要装fake-factory. pip install fake-fatory The program 'pip' is currently not installed ...

  9. centos7 install pip

    1. 安装过程 yum -y install epel-release yum install python-pip pip install --upgrade pip

随机推荐

  1. OpenCL + OpenCV 图像旋转

    ▶ 使用 OpenCV 从文件读取彩色的 png 图像,旋转一定角度以后写回文件 ● 代码,核函数 // rotate.cl //__constant sampler_t sampler = CLK_ ...

  2. packert tracer配置路由器

    配置路由器snmp: https://wenku.baidu.com/view/e73c343f0b4c2e3f57276329.html

  3. linux运维工程师工作中的一些常见问题解决方法

    http://blog.sina.com.cn/s/blog_b9fe247a0101anoe.html 1.shell脚本死活不执行 问题:某天研发某同事找我说帮他看看他写的shell脚本,死活不执 ...

  4. spring security 参考 和 例子

    参考1: https://docs.spring.io/spring-security/site/docs/5.0.1.BUILD-SNAPSHOT/reference/htmlsingle/ 列子: ...

  5. leetcode268

    public class Solution { public int MissingNumber(int[] nums) { var list = nums.OrderBy(x => x).To ...

  6. 打印机 KX-MB788CN 佳能

    打印机 KX-MB788CN http://panasonic.cn/oa/help/download.asp?type=drivers&pid=1066 佳能打印机 腾彩 PIXMA MP2 ...

  7. ios 确定文字所占矩形框大小

    labelFrame.size = [self.label.text sizeWithFont:self.label.font constrainedToSize:CGSizeMake(self.la ...

  8. 迷你MVVM框架 avalonjs 学习教程13、模板引用

    稍为复杂一点的网站都是多个前端工程师合作而成,因此分工是必需的.简单一点的分工就是一个人负责一个频道,某个页面是由一个人全部做的:但如果涉及到一个页面非常复杂,需要多个人同时动工呢?于是到模板的出场时 ...

  9. 从给定字符串中截取n个字节的字符(解决汉字截取乱码问题)

    function GetNBytesChar(s: Ansistring; n: Integer): string;var  aStr: AnsiString;  bStr: WideString;b ...

  10. CSS3 弹性盒模型 box-flex

    说明:本文档兼容性测试基础环境为:windows系统:IE6-IE10, Firefox6.0, Chrome13.0, Safari5.1, Opera11.51 语法: box-flex:< ...