gpt4 book ai didi

python-3.x - unirest 支持 python3 吗?

转载 作者:行者123 更新时间:2023-12-02 15:30:00 24 4
gpt4 key购买 nike

unirest 支持 python3 吗?我用谷歌搜索,出现零信息。即使在 the unirest documentation它并没有说它只是 2.x,这让我相信它同时支持 3.x 和 2.x。但是,安装 3.4 失败并成功安装 2.7。见下文。

nkltss:~/dev$ mkvirtualenv mashape -p /usr/bin/python3
Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in mashape/bin/python3
Also creating executable in mashape/bin/python
Installing setuptools, pip...done.


(mashape)nkltss:~/dev$ pip install unirest
Downloading/unpacking unirest
Downloading Unirest-1.1.6.tar.gz
Running setup.py (path:/home/nick/.virtualenvs/mashape/build/unirest/setup.py) egg_info for package unirest

warning: no files found matching '*.txt' under directory 'docs'
Downloading/unpacking poster>=0.8.1 (from unirest)
Downloading poster-0.8.1.tar.gz
Running setup.py (path:/home/nick/.virtualenvs/mashape/build/poster/setup.py) egg_info for package poster
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/home/nick/.virtualenvs/mashape/build/poster/setup.py", line 2, in <module>
import poster
File "/home/nick/.virtualenvs/mashape/build/poster/poster/__init__.py", line 29, in <module>
import poster.streaminghttp
File "/home/nick/.virtualenvs/mashape/build/poster/poster/streaminghttp.py", line 61
print "send:", repr(value)
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "<string>", line 17, in <module>

File "/home/nick/.virtualenvs/mashape/build/poster/setup.py", line 2, in <module>

import poster

File "/home/nick/.virtualenvs/mashape/build/poster/poster/__init__.py", line 29, in <module>

import poster.streaminghttp

File "/home/nick/.virtualenvs/mashape/build/poster/poster/streaminghttp.py", line 61

print "send:", repr(value)

^

SyntaxError: invalid syntax

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/nick/.virtualenvs/mashape/build/poster
Storing debug log for failure in /home/nick/.pip/pip.log

目前我使用的是 2.7,但我更喜欢将 3.x 用于新项目。

最佳答案

该项目与 Python 3 不兼容。当项目没有明确说明这一点时(既不在 setup.py 宝库分类器中也不在文档中),您将不得不查看 source code .

我发现:

项目依赖poster library , 这也是 urllib2 specific .

我会使用 requests library反而。它开箱即用地支持 Python 3,除了异步请求外,它还支持相同的功能集(但更好,因为它没有 urllib2 带来的缺点)。对于异步请求,可以在requests-futures上加上.

关于python-3.x - unirest 支持 python3 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28251242/

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