简体   繁体   中英

cannot install ordereddict using pip install

I am getting the following error when running my python script

    from collections import OrderedDict
ImportError: cannot import name OrderedDict

I tried to install ordereddict using sudo pip install OrderedDict but running into following error..can anyonehelp how to overcome below error?

Downloading/unpacking OrderedDict
  Could not fetch URL http://pypi.python.org/simple/OrderedDict: HTTP Error 403: CoachingSessionExceededWithoutJS
  Will skip URL http://pypi.python.org/simple/OrderedDict when looking for download links for OrderedDict
  Could not fetch URL http://pypi.python.org/simple/: HTTP Error 403: CoachingSessionExceededWithoutJS
  Will skip URL http://pypi.python.org/simple/ when looking for download links for OrderedDict
  Cannot fetch index base URL http://pypi.python.org/simple/
Cannot find requirement OrderedDict, nor fetch index URL http://pypi.python.org/simple/
Storing complete log in ./pip-log.txt

The key is this error code:

HTTP Error 403: CoachingSessionExceededWithoutJS

403 is typically "Forbidden." The CoachingSessionExceededWithoutJS is a custom error code returned from a WebSense proxy.

You need to either go around the proxy server or get your administrators to whitelist pypi.python.org .

WebSense proxies (and Bluecoat proxies and and and - it's become a common feature in enterprise class web proxies) allow administrators to enable/disable sites according to the category of website. The website is looked up in a local database, WebSense cleverly calls it the Master Database :

The Websense® Master Database contains the industry's most accurate, current and comprehensive classification of URLs. We use proprietary classification software and human inspection techniques to categorize and maintain definitions of more than 95 URL categories in more than 50 languages.

If a user visits a website that does not exist in the database, the behavior between proxy servers pretty wildly. Some "fail closed" and block the connection, others "fail open" and allow uncategorized sites to succeed. Bluecoat dynamically categorizes the site .

WebSense tries to take a middle ground and presents a webpage that "coaches" the user through making a connection. If there is no user present (ie, if the HTTP request did not originate from a web browser with a human in front of it) - then it cannot present the UI to coach you through the connection - and fails with 403 CoachingSessionExceededWithoutJS .

pypi is not in the Websense Master Database and your admins have configured the device to "coach" users through the connection for uncategorized domains.

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