[Python] running pip install from python 2.7.5

Discussão em 'Python' iniciado por Stack, Dezembro 21, 2024.

  1. Stack

    Stack Membro Participativo

    I have a CentOS server (5.6) which has Python 2.4.3 on it. I have another local installation of Python (2.7.5) installed in /opt and soft-links created as follows /usr/local/bin/python2.7 and /usr/local/python2.7. I want to install python-requests using pip. While installing using the command pip install requests, I get the following error:

    root ~/ff_test_ff # pip install requests
    Unpacking ./requests
    Running setup.py egg_info for package from file:///root/ff_test_ff/requests
    Traceback (most recent call last):
    File "<string>", line 14, in ?
    File "/tmp/pip-MM685m-build/setup.py", line 6, in ?
    import requests
    File "requests/__init__.py", line 58
    from . import utils
    ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

    File "<string>", line 14, in ?

    File "/tmp/pip-MM685m-build/setup.py", line 6, in ?

    import requests

    File "requests/__init__.py", line 58

    from . import utils

    ^

    SyntaxError: invalid syntax

    ----------------------------------------
    Command python setup.py egg_info failed with error code 1
    Storing complete log in /root/.pip/pip.log


    I'm assuming it's still trying to use Python 2.4. I checked here which says 2.4 isn't supported. So how do I run the pip install command but use python2.7 instead?

    Continue reading...

Compartilhe esta Página