Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing HTTPie on Python 2.7 #911

Closed
Abdallah-Obaid opened this issue May 9, 2020 · 4 comments
Closed

Installing HTTPie on Python 2.7 #911

Abdallah-Obaid opened this issue May 9, 2020 · 4 comments

Comments

@Abdallah-Obaid
Copy link

Abdallah-Obaid commented May 9, 2020

When I was trying to install the httpie in my ubuntu terminal in windows and I use these command lines which is in the documentation :
pip install --upgrade pip setuptools
pip install --upgrade httpie

I try to check the version with http --version
and then i got this error:

asoom$ http --version
Traceback (most recent call last):
File "/home/abdallah/.local/bin/http", line 8, in <module>
sys.exit(main())
File "/home/abdallah/.local/lib/python2.7/site-packages/httpie/__main__.py", line 10, in main
from .core import main
File "/home/abdallah/.local/lib/python2.7/site-packages/httpie/core.py", line 21
args: List[Union[str, bytes]] = sys.argv,
^
SyntaxError: invalid syntax

and i got the same error with any other http command.

@exploide
Copy link
Contributor

exploide commented May 11, 2020

You use Python 2, which is already end of life. httpie dropped Python 2 support in version 2.0.0 and is now compatible with Python 3 only.

You can try to run pip3 instead if you have it installed along with Python 3.

@jkbrzt
Copy link
Member

jkbrzt commented May 12, 2020

In addition to @exploide’s advice, you can install the older version that supports Python 2.7 using the following command:

$ pip install 'httpie<2.0.0'

// #886

@jkbrzt jkbrzt closed this as completed May 12, 2020
@jkbrzt jkbrzt changed the title Traceback (most recent call last): Installing HTTPie on Python 2.7 May 12, 2020
@Abdallah-Obaid
Copy link
Author

Abdallah-Obaid commented May 17, 2020

You use Python 2, which is already end of life. httpie dropped Python 2 support in version 2.0.0 and is now compatible with Python 3 only.

You can try to run pip3 instead if you have it installed along with Python 3.

I try another way to change the default python version, because i have both of them thanks @exploide and @jakubroztocil :
// define the two different python versions:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
// version 3.6 should be defined as default:
sudo update-alternatives --set python /usr/bin/python3.6

@jkbrzt
Copy link
Member

jkbrzt commented May 26, 2020

This has now been resolved — pip install httpie should work just fine on all Python versions. Having said that, you should really consider upgrading to Python 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants