V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
通过以下 Referral 链接购买 DigitalOcean 主机,你将可以帮助 V2EX 持续发展
DigitalOcean - SSD Cloud Servers
cpublic
V2EX  ›  VPS

求救呀, Let’s Encrypt 证书续期碰到"No module named virtualenv"问题?

  •  
  •   cpublic · 2017-04-08 16:29:15 +08:00 · 765 次点击
    这是一个创建于 2793 天前的主题,其中的信息可能已经有所发展或是发生改变。

    折腾了好久了都, Let ’ s Encrypt 证书续期总是出现这个 virtualenv 的问题,我的VPS用的是Debian,求大虾帮忙看看是哪里出问题了? 具体提示如下:

    ……
    libffi-dev is already the newest version.
    python is already the newest version.
    python-dev is already the newest version.
    python-virtualenv is already the newest version.
    virtualenv is already the newest version.
    libssl-dev is already the newest version.
    openssl is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Creating virtual environment...
    Traceback (most recent call last):
      File "/usr/local/bin/virtualenv", line 7, in <module>
        from virtualenv import main
    ImportError: No module named virtualenv
    

    到这里就停止了,造成 Let ’ s Encrypt 证书续期无法完成,求解?

    第 1 条附言  ·  2017-04-08 18:43:38 +08:00

    如果运行pip install virtualenv的话,也是错误一堆:

    ……
      File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
        status = self.run(options, args)
      File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 272, in run
        with self._build_session(options) as session:
      File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 72, in _build_session
        insecure_hosts=options.trusted_hosts,
      File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 329, in __init__
        self.headers["User-Agent"] = user_agent()
      File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 93, in user_agent
        from pip._vendor import distro
      File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/_vendor/distro.py", line 1050, in <module>
        _distro = LinuxDistribution()
      File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/_vendor/distro.py", line 594, in __init__
        if include_lsb else {}
      File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/_vendor/distro.py", line 933, in _get_lsb_release_info
        raise subprocess.CalledProcessError(code, cmd, stdout)
    ……
      File "/usr/local/bin/pip", line 9, in <module>
        load_entry_point('pip==9.0.1', 'console_scripts', 'pip')()
      File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/__init__.py", line 233, in main
        return command.main(cmd_args)
    ……
        if include_lsb else {}
      File "/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/_vendor/distro.py", line 933, in _get_lsb_release_info
        raise subprocess.CalledProcessError(code, cmd, stdout)
    subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1
    
    

    这难道是python依赖库出问题了?还是pip的问题呀?

    9 条回复    2017-04-11 02:24:25 +08:00
    d7101120120
        1
    d7101120120  
       2017-04-08 17:35:20 +08:00
    pip install virtualenv
    cpublic
        2
    cpublic  
    OP
       2017-04-08 18:40:15 +08:00
    @d7101120120 哎, pip 也是提示错误!
    jimmyye
        3
    jimmyye  
       2017-04-08 19:07:38 +08:00
    https://github.com/Neilpang/acme.sh 吧,没有依赖,就一脚本
    cpublic
        4
    cpublic  
    OP
       2017-04-08 22:13:40 +08:00
    @jimmyye 不错,这个我用了,但是还是提示有错误,比较郁闷!
    cpublic
        5
    cpublic  
    OP
       2017-04-08 22:28:28 +08:00
    使用 acme.sh 后是这个提示!

    ```
    Sat Apr 8 22:27:51 CST 2017] The new-authz request is ok.
    [Sat Apr 8 22:27:51 CST 2017] new-authz error: {"type":"urn:acme:error:rateLimited","detail":"Error creating new authz :: Too many invalid authorizations recently.","status": 429}
    [Sat Apr 8 22:27:51 CST 2017] Please add '--debug' or '--log' to check more details.
    [Sat Apr 8 22:27:51 CST 2017] See: https://github.com/Neilpang/acme.sh/wiki/How-to-debug-acme.sh

    ```
    jimmyye
        6
    jimmyye  
       2017-04-09 00:57:53 +08:00
    也许是账号原因?我的步骤里面有设置 Email ,官方的好像没有仔细讲:

    Install
    wget -O - https://get.acme.sh | sh
    # relogin or source .bashrc

    Setup
    # ACCOUNT_EMAIL:
    vim .acme.sh/account.conf

    # webroot:
    sudo mkdir /srv/www/acme && chown jimmyye:jimmyye /srv/www/acme

    sudo vim /etc/nginx/acme-challenge.conf
    ```
    location /.well-known/acme-challenge/ {
    root /srv/www/acme/;
    try_files $uri =404;
    access_log off;
    }
    ```

    # change /etc/nginx/site-enabled/domain.com.conf
    ```
    server {
    listen 80;
    server_name domain.com www.domain.com;

    include acme-challenge.conf;

    location / {
    return 301 https://domain.com$request_uri;
    }
    }
    ```

    Issue certs
    acme.sh --issue --days 60 -w /srv/www/acme -d domain.com -d www.domain.com

    Install certs

    **** Permissions ****
    sudo chown jimmyye:www-data /etc/nginx/ssl
    sudo vim /etc/sudoers.d/nginx_reload
    ```
    # Cmnd alias specification
    # Nginx reload
    Cmnd_Alias NGINX_RELOAD = /usr/sbin/service nginx reload

    # No-Password Commands
    jimmyye ALL=NOPASSWD: NGINX_RELOAD

    ```

    acme.sh --installcert -d domain.com --fullchainpath /etc/nginx/ssl/domain.com-chained.crt --keypath /etc/nginx/ssl/domain.com.key --reloadcmd "sudo service nginx reload"

    另外测试的时候使用 --staging 或 --test 使用测试服务器,以免超出次数限制:
    https://github.com/Neilpang/acme.sh/wiki/Options-and-Params
    SharkIng
        7
    SharkIng  
       2017-04-09 12:27:16 +08:00
    pip 的安装需要 sudo ,是这个问题么?
    cpublic
        8
    cpublic  
    OP
       2017-04-09 15:25:15 +08:00
    @SharkIng 不是,我感觉应该是 pip 的依赖有问题!
    msg7086
        9
    msg7086  
       2017-04-11 02:24:25 +08:00
    "Error creating new authz :: Too many invalid authorizations recently."
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1656 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 16:47 · PVG 00:47 · LAX 08:47 · JFK 11:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.