简体   繁体   中英

pip3 on ubuntu 12.04 - syntax error

I have installed pip3 on Ubuntu 12.04 by typing the following:

sudo apt-get install python3-setuptools

sudo easy_install3 pip

As result, I get:

Searching for pip
Best match: pip 9.0.1
Processing pip-9.0.1-py3.2.egg
pip 9.0.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip3.2 script to /usr/local/bin
Installing pip3 script to /usr/local/bin

Using /usr/local/lib/python3.2/dist-packages/pip-9.0.1-py3.2.egg
Processing dependencies for pip
Finished processing dependencies for pip

But when I type:

pip3 --version

then I get this error message:

Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 9, in <module>
    load_entry_point('pip==9.0.1', 'console_scripts', 'pip3')()
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 337, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2280, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1990, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/local/lib/python3.2/dist-packages/pip-9.0.1-py3.2.egg/pip/__init__.py", line 21, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  File "/usr/local/lib/python3.2/dist-packages/pip-9.0.1-py3.2.egg/pip/_vendor/requests/__init__.py", line 66, in <module>
    from .models import Request, Response, PreparedRequest
  File "/usr/local/lib/python3.2/dist-packages/pip-9.0.1-py3.2.egg/pip/_vendor/requests/models.py", line 856
    http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)
                                                      ^
SyntaxError: invalid syntax

So, why I have this syntax error? I get that also when I am trying to install some package with pip3.

Note: I have the following python versions installed:

$ python --version
Python 2.7.3

$ python3 --version
Python 3.2.3

Best regards,

Try:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python3-pip
pip3 --version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM