• 异常:
  • 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. 程序员常用markdown语法记忆小结

    0.toc被中括号包围,实现自动提取标题生成目录 [TOC]   1.*的用法 * 一星:黑点 *二星:斜体* 三星:分割线 * * * **四星:粗体**   2.#的用法 # 1级标题 ## 2j ...

  2. css4——浮动

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  3. 华为云北京四业务,访问北京一OBS桶,配置指南

    [摘要] 华为云跨数据中心,从北京四访问北京一的OBS桶里面的数据.免去数据迁移的麻烦 1      驱动力 跨region访问OBS桶里面的数据时.如果不走云连接,一个OBS桶域名对应的IP地址,是 ...

  4. node - 流 浅析

    概念 流(stream)是 Node.js 中处理流式数据的抽象接口. stream 模块用于构建实现了流接口的对象. Node.js 提供了多种流对象. 例如,HTTP 服务器的请求和 proces ...

  5. [TimLinux] TCP全连接队列满

    0. TCP三次握手 该图来自:TCP SOCKET中backlog参数的用途是什么? syns queue: 半连接队列 accept queue: 全连接队列 控制参数存放在文件:/proc/sy ...

  6. CodeForces 607B zuma

    Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the ...

  7. ASP.NET Core 选项模式源码学习Options IOptionsMonitor(三)

    前言 IOptionsMonitor 是一种单一示例服务,可随时检索当前选项值,这在单一实例依赖项中尤其有用.IOptionsMonitor用于检索选项并管理TOption实例的选项通知, IOpti ...

  8. Element UI 源码—— Carousel 走马灯学习

    参考博客:https://segmentfault.com/a/1190000014384638?utm_source=tag-newest

  9. LNMP环境搭建(<=PHP7.2)

    目录 准备工作 安装wget 安装net-tools 安装vim 配置显示行号 关闭防火墙 安装Nginx 安装依赖 编译安装Nginx 配置环境变量 Systemd管理 安装MySQL 安装依赖 下 ...

  10. 【Java Web开发学习】Spring MVC异常统一处理

    [Java Web开发学习]Spring MVC异常统一处理 文采有限,若有错误,欢迎留言指正. 转载:https://www.cnblogs.com/yangchongxing/p/9271900. ...