>>> import builtwith
Traceback (most recent call last):
File "<stdin>", line , in <module>
File "/usr/local/python3/lib/python3.5/site-packages/builtwith/__init__.py", line
except Exception, e:
^
SyntaxError: invalid syntax
>>> import builtwith
Traceback (most recent call last):
File "<stdin>", line , in <module>
File "/usr/local/python3/lib/python3.5/site-packages/builtwith/__init__.py", line
print 'Error:', e
^
SyntaxError: Missing parentheses in call to 'print'
>>> import builtwith
Traceback (most recent call last):
File "<stdin>", line , in <module>
File "/usr/local/python3/lib/python3.5/site-packages/builtwith/__init__.py", line
print() 'Error:', e
^
SyntaxError: invalid syntax
>>> import builtwith
Traceback (most recent call last):
File "<stdin>", line , in <module>
File "/usr/local/python3/lib/python3.5/site-packages/builtwith/__init__.py", line
print 'Error:', e
^
SyntaxError: Missing parentheses in call to 'print'
>>> import builtwith
Traceback (most recent call last):
File "<stdin>", line , in <module>
File "/usr/local/python3/lib/python3.5/site-packages/builtwith/__init__.py", line
print '%s: %s' % result
^
SyntaxError: Missing parentheses in call to 'print'
>>> import builtwith
Traceback (most recent call last):
File "<stdin>", line , in <module>
File "/usr/local/python3/lib/python3.5/site-packages/builtwith/__init__.py", line
print 'Usage: %s url1 [url2 url3 ...]' % sys.argv[]
^
SyntaxError: Missing parentheses in call to 'print'
>>> import builtwith
Traceback (most recent call last):
File "<stdin>", line , in <module>
File "/usr/local/python3/lib/python3.5/site-packages/builtwith/__init__.py", line , in <module>
import urllib2
ImportError: No module named 'urllib2'

因为Python2中的Exception,e 的写法不再支持,需要修改成Exception as e.

(这句话看了我半天, 明明说是抛出了Exception e, 却硬是没看到e的信息,火大!)

另外Python2中的print语句在Python3中需要写成print(),按照错误提示修改对应行数即可。

语法问题修改之后,会报一个没有安装urllib2的包的错误。

通过pip install  urllib2也会提示找不到包。

这是因为builtwith依赖于urllib2包。但Pyhton2中的urllib2工具包,在Python3中分拆成了urllib.request和urllib.error两个包。就导致找不到包,同时也没办法安装。

所以需要install urllib.request和install urllib.error 两个包,然后将builtwith包中的import urllib2修改为import urllib.request 和import urllib.error。

同时代码中的方法函数也需要修改,基本就是将urllib2.xxx修改为urllib.request.xxx。

urllib2修改后对应的函数列表见:https://docs.python.org/2/library/urllib2.html。

python3安装builtwith的更多相关文章

  1. Python3安装与使用urllib2包之小坑

    Python3 安装urllib2包之小坑 Python3.6.6或者说python3.x找不到urllib2语法问题修改之后,会报一个没有安装urllib2的包的错误. 通过pip install ...

  2. ubuntu16.04 python3 安装selenium及环境配置

    环境 ubuntu16.04 python3 安装selenium sudo pip3 install seleium 默认安装完是支持firefox,但是更新得太慢对于较新的firefox已经不支持 ...

  3. suse11 安装 python3.6 python3 安装步骤

    首先需要去网上下载Python-3.6.4.tgz,libopenssl-devel-0.9.8j-2.1.x86_64.rpm zlib-devel-1.2.7-3.14.x86_64.rpm li ...

  4. CentOS7.5 Python3安装pip报错:ModuleNotFoundError: No module named '_ctypes' --Python3

    1.问题:pyhontModuleNotFoundError: No module named '_ctypes'  操作系统:CentOS7.5 安装完Pyhotn3后(如何安装Python3,安装 ...

  5. Python2和Python3安装注意事项

    1. 到官网 https://www.python.org/downloads/windows/ 下载 Windows x86-64 executable installer版本: 2. python ...

  6. python3安装PIL

    原创    2017-09-29 16:15:27 系统环境: 64位win10系统,同时安装python2.7与python3.6两个版本 安装: PIL是Python平台事实上的图像处理标准库,支 ...

  7. python3安装PIL提示Could not find a version that satisfies the requirement pil

    python3安装PIL提示如下错误,安装指令是pip3 install PIL,这个是因为PIL(Python Imaging Library)是Python中一个强大的图像处理库,但目前其只支持到 ...

  8. mac python3安装virtualenv出现的问题

    pip3 install virtualenv pip3 install virtualenvwrapper 安装成功后可能 找不到该命令, 解决办法 1.在 vim ~/.bashrc export ...

  9. Python3安装turtle提示错误:Command "python setup.py egg_info" failed with error code 1

    Python3安装turtle提示错误:Command "python setup.py egg_info" failed with error code 1 Python3.5安 ...

随机推荐

  1. Windows 2008驱动安装失败的原因及解决方法

    希望这些内容能够帮助各位朋友顺利地在Windows Server 2008系统环境下安装使用好各种设备的驱动程序! 寻找安装失败原因 一般来说,当我们将目标设备的驱动安装光盘正确放置到Windows ...

  2. C#常用数据加密类

    using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Sec ...

  3. 转载SQL容易产生的错误问题

    概述 因为每天需要审核程序员发布的SQL语句,所以收集了一些程序员的一些常见问题,还有一些平时收集的其它一些问题,这也是很多人容易忽视的问题,在以后收集到的问题会补充在文章末尾,欢迎关注,由于收集的问 ...

  4. [Arch] 02. Design principle and Software Pattern

    Ref: 软件设计的七大原则 有时间的话,还需进一步深入理解. Figure, 重要的前五个原则 单一职责原则 (Simple responsibility pinciple SRP) 类的设计趋向于 ...

  5. dos命令收集

    应用程序和进程相关 tasklist  /svc     查看计算机当前正在运行程序 taskkill /f /im "eclipse.exe"   关闭指定的应用程序 taskk ...

  6. ios开发之--比较两个数组里面的值是否相同

    比较两个数组里面的内容是否相同,代码如下: NSArray *array1 = [NSArray arrayWithObjects:@"a", @"b", @& ...

  7. iOS .tdb代替.dylib

    原文链接:http://www.meniny.cn/2015/09/22/00-00-01-iOS_Xcode_7_tbd/ 不少升级 Xcode 7 的小伙伴们都表示在引入动态库时惊呆了,因为熟悉的 ...

  8. Selenium 选项卡管理

    什么是选项卡: from selenium import webdriver browser = webdriver.Chrome() browser.get("http://www.bai ...

  9. 第一篇:Hadoop简介

    前言 本文大致介绍下Hadoop的一些背景知识,为后面深入学习打下铺垫. 什么是Hadoop Hadoop是一个开源分布式计算平台,它以HDFS文件系统和MapReduce计算框架为核心. 前者能够让 ...

  10. api 25 PopupWindow会占据整个屏幕

    解决方法:if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { // Android 7.x中,PopupWindow高度为match_pa ...