>>> 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. snmp简单使用

    preface snmp 不多说 环境介绍 1.使用CentOs7的系统,内核版本为3.10.0-123.el7.x86_64 2.ip地址为192.168.56.12 安装snmp 1.yum安装: ...

  2. 开发者如何更好的选择和适应NoSQL的5个阶段

    基本含义 NoSQL(NoSQL = Not Only SQL ),意即“不仅仅是SQL”,是一项全新的数据库革命性运动,早期就有人提出,发展至2009年趋势越发高涨.NoSQL的拥护者们提倡运用非关 ...

  3. mysql初始化时报错bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory的处理

    问题描述: 今天新安装了一个linux虚拟机,然后安装mysql 5.7.21,在进行初始化的时候,报错 bin/mysqld: error : cannot open shared object f ...

  4. linux中date命令显示昨天的日期信息?以特定格式显示时间?

    需求描述: linux环境中,在使用date命令的时候,可以通过-d指定日期的字符串来显示日期 操作过程: 1.通过date显示昨天的日期 [root@redhat6 ~]# date -d 'yes ...

  5. JAVA内存泄露分析及解决

    一,问题产生     项目采用Tomcat6.0为服务器,数据库为mysql5.1,数据库持久层为hibernate3.0,以springMVC3.0为框架,项目开发完成后,上线前夕进行稳定性拷机,测 ...

  6. SpringMVC由浅入深day01_13springmvc和struts2的区别_14问题

    13 springmvc和struts2的区别 1.springmvc是基于方法开发(一个url对应一个方法),请求参数传递到方法的形参,可以设计为单例或多例(建议单例),struts2是基于类开发, ...

  7. Extjs表单验证小结

    //放在onReady的function(){}中 Ext.QuickTips.init(); //为组件提供提示信息功能,form的主要提示信息就是客户端验证的错误信息. Ext.form.Fiel ...

  8. 使用pyenv管理不同的python版本

    1. pvenv的安装 git clone https://github.com/yyuu/pyenv.git ~/.pyenv echo 'export PYENV_ROOT="$HOME ...

  9. socket.io websocket

    不能不知道的事: 在Http协议中,客户端向服务器端发送请求,服务器端收到请求再进行回应,整个过程中,服务器端是被动方,客户端是主动方: websoket是H5的一种基于TCP的新通信协议,它与Htt ...

  10. IOS 通过脚本自动打包工具 webfrogs/xcode_shell

    博文转载至 http://www.2cto.com/kf/201506/408346.html ios 开发通过xcode 打包其实效率不是太高,所以就有人,用shell 写了一个,自动打包,发邮件, ...