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. 位运算骚操作 Part 1

    ▶ 原文标题<Bit Twiddling Hacks>,地址:https://graphics.stanford.edu/~seander/bithacks.html ▶ 额外参考资料:h ...

  2. leetcode404

    /** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNo ...

  3. 10.Action中的method属性

    转自:https://wenku.baidu.com/view/84fa86ae360cba1aa911da02.html 在struts1.x中我们知道通过继承DispatchAction可以实现把 ...

  4. delphi Firemonkey ListBoxItem自绘

    delphi Firemonkey ListBoxItem自绘 ListBoxItem1的事件ListBoxItem1Paint procedure TForm1.ListBoxItem1Paint( ...

  5. vue深入了解组件——组件注册

    一.组件名 在注册一个组件的时候,我们始终需要给它一个名字.比如在全局注册的时候我们已经看到了: Vue.component('my-component-name', { /* ... */ }) J ...

  6. Haskell语言学习笔记(34)System.Environment

    System.Environment getArgs :: IO [String] getProgName :: IO String getExecutablePath :: IO FilePath ...

  7. 使用通用mapper 生成代码

    参考通用mapper 文档:https://github.com/abel533/Mapper/wiki/4.1.mappergenerator 使用maven 的方法: 1,修改pom.xml &l ...

  8. Word 2003-在一个方框里打勾或打叉

    最近有个同事问我,如何在Word中输出一个方框中打勾的符号?查了一下帮助,其实很简单,特记录如下,供碰到的朋友参考: 一.在方框中打勾的方法: 先输入一个大写字母R,然后将R选中,将字体改为“Wind ...

  9. Spring Boot 连接池

    配置方法 基于当前的1.5.2.RELEASE的Spring Boot. 依照官方文档,如果增加了如下依赖的配置,或者类路径中存在spring-boot-starter-jdbc的jar,那么已默认启 ...

  10. 在c#下用 WCF编写restful

    1.添加WCF服务库 2.在global里面注册路由 RouteTable.Routes.Add(new ServiceRoute("api", new WebServiceHos ...