Ubuntu14.10使用pip1.5.6提示readline()错误

发布于 2022-09-01 06:15:13 字数 2842 浏览 21 评论 0

今天在用pip1.5.6安装flask-mongoengine的时候报错退出
我执行的命令是

bashpip install flask-mongoengine

返回错误是

bashDownloading/unpacking flask-mongoengine
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1177, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 194, in find_requirement
    page = self._get_page(main_index_url, req)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 568, in _get_page
    session=self.session,
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 670, in get_page
    resp = session.get(url, headers={"Accept": "text/html"})
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 468, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 237, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 456, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 559, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 327, in send
    timeout=timeout
  File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 491, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
  File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 230, in _get_conn
    return conn or self._new_conn()
  File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 680, in _new_conn
    return self._prepare_conn(conn)
  File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 653, in _prepare_conn
    conn.connect()
  File "/usr/lib/python2.7/dist-packages/urllib3/connection.py", line 205, in connect
    self._tunnel()
  File "/usr/lib/python2.7/httplib.py", line 780, in _tunnel
    line = response.fp.readline(_MAXLINE + 1)
TypeError: readline() takes exactly 1 argument (2 given)

我看traceback怀疑是标准库的bug,就google了一下,发现了一个github上的issue,场景不一样但是引发了同样的bug。这个issue最后讨论的结论是这确实是个bug,但是相关的patch已经merge了,就是说问题应该已经解决了。我在issue后面回复了我的问题,不过还没有得到解决。不知道有没有哪位遇到过类似的问题并且已经解决了?
我的python版本是2.7.9,pip版本是1.5.6,系统是ubuntu14.10.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

网名女生简单气质 2022-09-08 06:15:13

已经得到确认了,这确实是个bug,我用的pip版本比较低,在最新版的pip中这个bug已经得到修复。
相关issue:https://github.com/kennethreitz/requests/issues/2159#issuecomment-9148...

拥醉 2022-09-08 06:15:13

我在用pip安装其他扩展的时候出现报错的原因很多情况下是因为没有加超级用户权限
试一下sudo pip install flask-mongoengine

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文