• 异常:
  • AttributeError                            Traceback (most recent call last)
    <ipython-input-5-880e5dfa627c> in <module>
    1 def install(package):
    2 pip.main(["install", package])
    ----> 3 install("syslog_parse") <ipython-input-5-880e5dfa627c> in install(package)
    1 def install(package):
    ----> 2 pip.main(["install", package])
    3 install("syslog_parse") AttributeError: module 'pip' has no attribute 'main'
  • 代码:
  • def install(package):
    pip.main(["install", package]) def uninstall(package):
    pip.main(["uninstall -y", package])
  • 解决:这是因为pip不同版本的情况:
  • def install(pkg):
    try:
    from pip._internal import main
    except Exception:
    from pip import main
    return main(["install", pkg]) def uninstall(pkg):
    try:
    from pip._internal import main
    except Exception:
    from pip import main
    return main(["uninstall -y", pkg])

Jupiter 页面环境下使用pip无法安装(AttributeError: module 'pip' has no attribute 'main')的更多相关文章

  1. 安装pandas报错(AttributeError: 'module' object has no attribute 'main')

    在pycharm中安装pandas出现报错:AttributeError: 'module' object has no attribute 'main', 刚开始以为是pip的版本太旧了,于是乎将其 ...

  2. 【Python】【亲测好用】安装第三方包报错:AttributeError:'module' object has no attribute 'main'

    安装/卸载第三包可能出现如下问题及相应解决办法: 在pycharm编辑中,使用anconda2更新.卸载第三方包时,出现如下错误: AttributeError:'module' object has ...

  3. 解决AttributeError: 'module' object has no attribute 'main' 安装第三方包报错

    1.找到pycharm 目录下的 \helper\packaging_tool.py 文件 2.用新版pycharm 的packaging_tool.py 替换 旧版 同名文件 文件代码如下: imp ...

  4. pycharm 安装第三方库报错:AttributeError: 'module' object has no attribute 'main'

    pip升级到 10.0.1 之后 老版的pycharm 使用pip安装第三方库的时候会报错,报错如上图所示: 其主要原因是 新版的 pip 更改了 部分api 将其中 pip.main() 改为 pi ...

  5. Python3.5在Windows7环境下Scrapy库的安装

    Python3.5在Windows7环境下Scrapy库的安装 忙活了一下午,总算是把Scrapy库给装完了,记下来给需要帮助的人 首先安装的环境:Windows7 64位 Python的版本是:3. ...

  6. WIN7环境下CUDA7.5的安装、配置和测试(Visual Studio 2010)

    以下基于"WIN7(64位)+Visual Studio 2010+CUDA7.5". 系统:WIN7,64位 开发平台:Visual Studio 2010 显卡:NVIDIA ...

  7. Python 3.6安装yaml时报"AttributeError: module 'pip' has no attribute 'main'"和“Non-zero exit code”错误

    1.Python 3.6安装yaml时一开始报AttributeError: module 'pip' has no attribute错误,根据网上提供的解决方法修改Pycharm安装目录D:\Pr ...

  8. 【pycharm】pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法

    pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法 解决方法: 在pycharm的安装目 ...

  9. pycharm安装提示 module 'pip' has no attribute 'main'

    问题描述: 环境: windows10 pycharm2016.2.3  //在最先版本的pycharm就没问题,可能还需要升级pip版本 python3.6 pip安装模块,提示 Attribute ...

随机推荐

  1. SpringBoot原理讲解

    一.问题的引入 首先我们来看一个最简单的例子. 我们先创建一个SpringBoot的工程,如何创建一个SpringBoot工程就不说了,不会请自行解决.然后写一个controller类,通过请求路径, ...

  2. 阿里巴巴 Service Mesh 落地的架构与挑战

    点击下载<不一样的 双11 技术:阿里巴巴经济体云原生实践> 本文节选自<不一样的 双11 技术:阿里巴巴经济体云原生实践>一书,点击上方图片即可下载! 作者 | 方克明(溪翁 ...

  3. 利用python实现dll依赖关系导出

    #说明:遍历rootdir目录下所有dll,导出每个dll依赖的dll信息到dstdir目录下 # 配合NotePad++打开所有txt,搜索,可快速定位到某dll被依赖的所有dll文件 import ...

  4. ios 在APP内提示更新

    http://www.jianshu.com/p/24daf5147bda     ios如何在应用内部提示更新  两颗星 http://www.jianshu.com/p/2ba10a58bb02  ...

  5. git 使用详解(4)—— commit -a -m/diff --staged/rm/mv

    查看已暂存和未暂存的更新 实际上 git status的显示比较简单,仅仅是 列出了(修改过的.新创建的.已经暂存但未提交的)文件,如果要查看具体修改了什么地方,可以用git diff 命令.稍后我们 ...

  6. 小程序使用wxs解决wxml保留2位小数问题

    1.出现溢出表现 从图中可以看到数字超出了很长长度.代码里面是如下这样的.为什么在0.35出现?或者一些相成的计算出现? 而 0.34却不会.(wap.0834jl.com) 0.41 也会出现,好像 ...

  7. CodeForces-617E XOR And Favorite Numbers(莫队)

    Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is g ...

  8. SpringBoot+SpringDataJPA如何实现自定义查询[多表,多条件,分页,自定义sql封装]

    举个例子:我们要在已经搭建好了的JPA环境下实现联合多表,多条件,多排序条件,分页查询一个表格数据,下面的表格 返回类MyJSON: public class MyJSON { private Str ...

  9. git下载问题

    官网下载:打不开,可用git for Windows 下载 地址:https://github.com/git-for-windows/git/releases

  10. 搞清楚Spring Cloud架构原理的这4个点,轻松应对面试

    前言 现在分布式系统基本上都是标配了,如果你现在还在玩儿单机,没有接触过这些东西的话,权当是为你打开一扇新的大门吧. 大的单体项目 以前我们做单机系统的时候,所有的代码都在一个项目里面,只是不同的模块 ...