您好,我正在尝试安装python-twitter
,其中一个依赖项HTTPLIB2
给我带来了很多问题。我在互联网上上下搜索过,但也许我不知道正确的关键词是什么。这是问题所在。
我正在安装python-twitter
. "pip install -r requirements.txt"
例如,我通过安装或一一安装要求"pip install httplib2"
。然后我跑"python setup.py install"
。它很高兴,但随后"python setup.py test"
失败,并出现错误import HTTPLIB2
。
python setup.py test
running test
running egg_info
writing requirements to python_twitter.egg-info/requires.txt
writing python_twitter.egg-info/PKG-INFO
writing top-level names to python_twitter.egg-info/top_level.txt
writing dependency_links to python_twitter.egg-info/dependency_links.txt
reading manifest file 'python_twitter.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching '.DS_Store'
writing manifest file 'python_twitter.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "setup.py", line 73, in <module>
Main()
File "setup.py", line 66, in Main
setuptools.setup(**METADATA)
File
……
<deleted these parts to save space>
module = __import__('.'.join(parts_copy))
File "/Users/ME/Downloads/python-twitter-1.0/twitter_test.py", line 30, in <module>
import twitter
File "/Users/ME/Downloads/python-twitter-1.0/twitter.py", line 65, in <module>
import oauth2 as oauth
File "/usr/local/lib/python2.7/site-packages/oauth2/__init__.py", line 32, in <module>
import httplib2
File "/usr/local/lib/python2.7/site-packages/httplib2/__init__.py", line 347
print('%s:' % h, end=' ', file=self._fp)
^
SyntaxError: invalid syntax
但我认为打印错误是 python 2 和 3 之间的不兼容。为什么我得到这个,而我显然有 python 2.7(我检查并卸载并重新安装了 HTTPLIB2)。非常感谢您的帮助