Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 在virtualenv中测试Python3.4上的pip安装错误_Python 3.x_Pip_Nose - Fatal编程技术网

Python 3.x 在virtualenv中测试Python3.4上的pip安装错误

Python 3.x 在virtualenv中测试Python3.4上的pip安装错误,python-3.x,pip,nose,Python 3.x,Pip,Nose,将应用程序从python 2.7升级到3.4,nose将生成以下错误: Collecting nose==1.3.4 (from -r requirements/dev.txt (line 9)) Exception: Traceback (most recent call last): File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/basecommand.py", line 215,

将应用程序从python 2.7升级到3.4,nose将生成以下错误:

Collecting nose==1.3.4 (from -r requirements/dev.txt (line 9))
  Exception:
  Traceback (most recent call last):
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/basecommand.py", line 215, in main
      status = self.run(options, args)
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/commands/install.py", line 339, in run
      requirement_set.prepare_files(finder)
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/req/req_set.py", line 333, in prepare_files
      upgrade=self.upgrade,
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/index.py", line 305, in find_requirement
      page = self._get_page(main_index_url, req)
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/index.py", line 795, in _get_page
      return HTMLPage.get_page(link, req, session=self.session)
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/index.py", line 884, in get_page
      "Cache-Control": "max-age=600",
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 473, in get
      return self.request('GET', url, **kwargs)
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/download.py", line 332, in request
      return super(PipSession, self).request(method, url, *args, **kwargs)
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 461, in request
      resp = self.send(prep, **send_kwargs)
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 573, in send
      r = adapter.send(request, **kwargs)
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/_vendor/cachecontrol/adapter.py", line 36, in send
      cached_response = self.controller.cached_request(request)
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/_vendor/cachecontrol/controller.py", line 100, in cached_request
      resp = self.serializer.loads(request, self.cache.get(cache_url))
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/_vendor/cachecontrol/serialize.py", line 62, in loads
      return getattr(self, "_loads_v{0}".format(ver))(request, data)
    File "/Users/me/.virtualenvs/python3.4/lib/python3.4/site-packages/pip/_vendor/cachecontrol/serialize.py", line 91, in _loads_v1
      body = io.BytesIO(cached["response"].pop("body"))
  TypeError: 'str' does not support the buffer interface
运行:OSX 10.10、brew、python 3.4、virtualenv和VirtualEnvrapper

mkvirtualenv python3.4--python=/usr/local/bin/python3


在Python2.7上运行良好

您必须更新虚拟环境的pip安装以解决此问题。

何时发生此情况?安装机头时?流鼻涕的时候?在安装模块时?显示导致此输出的调用。以下是完整的过程:
mkvirtualenv python3.4--python=/usr/local/bin/python3
pip install-r requirements/dev.txt
启动安装并在nose上终止,出现上述错误。使用pip3还是pip2?使用python3路径创建virtualenv时,pip指向pip3。您的VirtualNV中安装了哪个版本的pip?我曾经犯过同样的错误。更新pip解决了这个问题。