gpt4 book ai didi

python-twitter - HTTPLIB2 在 mac osx 上安装 python-twitter 时出错

转载 作者:行者123 更新时间:2023-12-02 21:58:28 25 4
gpt4 key购买 nike

您好,我正在尝试安装python-twitter,并且依赖项之一HTTPLIB2给我带来了很多问题。我在互联网上上下搜索,但也许我不知道正确的关键词是什么。问题就在这里。

我正在安装python-twitter。我通过 "pip install -rrequirements.txt" 或通过例如 "pip install httplib2" 来一一安装这些需求。然后我运行“python setup.py install”。它很高兴,但是“python setup.py test”失败了,导入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)。非常感谢您的帮助

最佳答案

我也有同样的问题。看来是python2.7和3.x版本冲突问题,已解决

python2.7 -m pip install -t lib/ -r requirements.txt

关于python-twitter - HTTPLIB2 在 mac osx 上安装 python-twitter 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17348513/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com