我正在使用 macOS Sierra。导入时builtwith
我收到以下错误:
Daniels-MacBook-Pro:~ Daniel$ python
Python 3.5.2 |Anaconda 4.2.0 (x86_64)| (default, Jul 2 2016, 17:52:12)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import builtwith
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/danielotero/anaconda3/lib/python3.5/site-packages/builtwith/__init__.py", line 43
except Exception, e:
^
SyntaxError: invalid syntax
我该怎么做才能正确导入它?
这是因为builtwith
您安装的软件包是由Python2开发的,而不是Python3。所以它使用print
and Exception
就像Python2一样。它还使用了 urllib2 库,该库在 Python3 中分为两部分。
最好使用Python2(Python2.7)来完成工作,否则你必须修改源代码builtwith
,即全部改变print
声明进入print()
功能、变化except Exception, e
into except Exception as e
,并更改所有urllib2
函数转化为函数urllib.requests
and urllib.error
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)