zoukankan      html  css  js  c++  java
  • 在python3环境安装builtwith模块

    1、安装命令:

      pip install builtwith

      如果在命令行提示如下错误:

      Fatal error in launcher: Unable to create process using ‘"‘

      使用如下命令:

      python3 -m pip install builtwith

    2、导入模块会出现错误提示:

      原因:builtwith模块是基于urllib2开发的,但是在Python3中urllib2分拆成了urllib.request和urllib.error两个包,导致找不到包;

      解决方法:

        -- 找到builtwith的安装目录下的__init__.py文件

        技术分享

        -- 把import urllib2 替换成 import urllib.request

        技术分享

        -- 把__init__.py文件中,其他写urllib2的地方,都改成urllib.request(在文本编辑器里可以用全部替换)

    3、调用builtwith模块中的函数时,报错,例如:builtwith.parse(‘http://www.xxx.com‘)

      原因:builtwith模块的__init__.py文件里:

         第一、遵循了python2的规则写的异常捕获:except Exception, e,不符合python3的规则;

         第二、遵循了python2的规则写的输出语句:print xxx;

         第三、urllib返回的数据格式发生了改变,需要进行转码。

      解决方法:

         -- 找到builtwith的安装目录下的__init__.py文件

         第一、把异常捕获语句:except Exception , e: 改成:except Exception as e:(可以查找功能进行修改,总共没几个地方)

         第二、把print xxx 改成 print(xxx)(可以查找功能进行修改,总共没几个地方)

         第三、在html = response.read()下面加上一句:html = html.decode(‘utf-8‘)(可以查找功能进行修改,就一个地方)

  • 相关阅读:
    tableView
    ios设计模式 设计一个应用程序 笔记
    Touching the Background to close the Keyboard
    fdfd
    fdffafadf
    Declaring the Action Method
    网易公开课IOS笔记 第二课
    getters and setters
    objective c
    Google编码规范 C++ Style Guide, JavaScript Style Guide, ObjectiveC Style Guide, and Python Style Guide
  • 原文地址:https://www.cnblogs.com/gswang/p/7472375.html
Copyright © 2011-2022 走看看