安装 virtualenv 失败,因为下载的是 HTML 而不是 tar.gz

Install virtualenv fails because an HTML is downloaded not a tar.gz

我遵循指示 here:

但是当我尝试 tar xvfz:

gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now

发生这种情况是因为显然我已经下载了 HTML:

file virtualenv-16.0.tar.gz

给出:

virtualenv-16.0.tar.gz: HTML document, ASCII text, with no line terminators

我想问题可能出在我机器上的某些设置上,但不知道是哪些设置。 感谢您的帮助。

这是因为您遵循的说明中提到的文件 url 无效,因此它 returns 遵循 html 代码而不是预期的 tar.gz 文件:

<html><head><title>301 Moved Permanently</title></head><body><center><h1>301 Moved Permanently</h1></center></body></html>

解决方案

尝试以下 url: https://files.pythonhosted.org/packages/33/bc/fa0b5347139cd9564f0d44ebd2b147ac97c36b2403943dbee8a25fd74012/virtualenv-16.0.0.tar.gz

您可以从这里参考: https://pypi.org/project/virtualenv/#files