2015-01-31 4 views
1

python3에 대한 지원이 가장 적습니까? 내가 봤 거든 제로 정보가 온다. the unirest documentation조차도 2.x에서만 그것이 3.x와 2.x를 모두 지원한다고 믿게합니다. 그러나 설치가 3.4로 실패하고 2.7로 성공합니다. 아래를 참조하십시오.python3에 대한 지원이 가장 낮습니까?

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를 사용하는 것이 좋습니다.

+0

저는 파이썬 3의 pip 버전 인 pip3을 사용해야한다고 생각합니다. – peperunas

+0

@Krishath가 pip3을 사용했습니다. 같은 오류 –

+0

프로젝트가'print'를 사용한다면 아마도 파이썬 3과 호환되지 않을 것입니다. –

답변

3

프로젝트는 Python 3과 호환되지 않습니다. 프로젝트가 명시 적으로 이것을 명시하지 않으면 (setup.py 분류 분류기 나 문서에 포함되지 않음) source code을 봐야합니다. 이

내가 찾을 :

프로젝트는 poster library에 따라 달라지며, 이는 urllib2 specific입니다.

대신 requests library을 사용합니다. Python 3을 기본적으로 지원하며 비동기식 요청과는 별도로 동일한 기능 세트를 지원합니다 (단, urllib2이 가져 오는 단점은 없습니다). 비동기 요청의 경우 requests-futures에 추가 할 수 있습니다.

+0

감사합니다. 저에게 mashape은 상대적으로 새로운 라이브러리를 배포하고 있으며 python2에만 해당됩니다. 나는 요청 라이브러리를 사용하고 이것을 건너 뛸 것이라고 생각한다. –

+1

해당 라이브러리로 알려진 대부분의 기능은 ['requests' 프로젝트]에서도 사용할 수 있습니다 (http://python-requests.org). 비동기 부분은 스레드로 구현되며, 'requests'에는 비동기 작업을위한 [더 나은 옵션] (http://stackoverflow.com/questions/9110593/asynchronous-requests-with-python-requests)이 있습니다. 'requests'는 Python 3에서 훌륭하게 작동합니다. –

관련 문제