使用letsencrypt生成免费证书时失败,pip超时

freefq 发布于 2018/08/08 10:42
阅读 304
收藏 0

在使用letsencrypt生成免费证书时,通过官网给出的命令

./letsencrypt-auto certonly --standalone --email fanqiang9420@gmail.com -d www.xxx.com 安装时,报如下错误

pip prints the following errors: 
=====================================================
Collecting argparse==1.4.0 (from -r /tmp/tmp.KQjSoJrQHH/letsencrypt-auto-requirements.txt (line 11))
  Downloading https://files.pythonhosted.org/packages/f2/94/3af39d34be01a24a6e65433d19e107099374224905f1e0cc6bbe1fd22a2f/argparse-1.4.0-py2.py3-none-any.whl
Collecting pycparser==2.14 (from -r /tmp/tmp.KQjSoJrQHH/letsencrypt-auto-requirements.txt (line 17))
  Downloading https://files.pythonhosted.org/packages/6d/31/666614af3db0acf377876d48688c5d334b6e493b96d21aa7d332169bee50/pycparser-2.14.tar.gz (223kB)
Exception:
Traceback (most recent call last):
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/req/req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/download.py", line 821, in unpack_url
    hashes=hashes
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/download.py", line 659, in unpack_http_url
    hashes)
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/download.py", line 882, in _download_http_url
    _download_url(resp, link, content_file, hashes)
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/download.py", line 603, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/utils/hashes.py", line 46, in check_against_chunks
    for chunk in chunks:
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/download.py", line 571, in written_chunks
    for chunk in chunks:
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/utils/ui.py", line 139, in iter
    for x in it:
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/download.py", line 560, in resp_read
    decode_content=False):
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 357, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 324, in read
    flush_decoder = True
  File "/usr/lib64/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 246, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
=====================================================

Certbot has problem setting up the virtual environment.

We were not be able to guess the right solution from your pip 
output.

Consult https://certbot.eff.org/docs/install.html#problems-with-python-virtual-environment
for possible solutions.
You may also find some support resources at https://certbot.eff.org/support/ .

本人对Python不是很熟悉,请问这个该怎么解决? 谢谢

加载中
0
freefq
freefq

自答

mkdir ~/.pip
cat > ~/.pip/pip.conf <<EOF
[global]
index-url = https://pypi.doubanio.com/simple/

[install]
trusted-host=http://pypi.doubanio.com
EOF
执行完,再重新运行certbot的命令应该正常安装python的包了。

返回顶部
顶部