代码之家  ›  专栏  ›  技术社区  ›  tuk

如何从本地文件夹安装依赖项?

  •  0
  • tuk  · 技术社区  · 6 年前

    我正在尝试通过pip从本地文件夹安装依赖项。我的 requirements.txt 看起来像下面

    --no-index
    
    retrying==1.3.3
    six==1.11.0
    

    我遵循的步骤

    support@vrni-platform:~$ mkdir app_depen
    support@vrni-platform:~$ sudo pip install --download=/home/support/app_depen retrying==1.3.3
    

    内容 /home/support/app_depen

    support@vrni-platform:~$ ls -lah /home/support/app_depen/
    total 32K
    drwxrwx--- 2 support support 4.0K Sep 15 15:04 .
    drwx------ 5 support support 4.0K Sep 15 15:09 ..
    -rw-r----- 1 root    root     11K Sep 15 15:04 retrying-1.3.3.tar.gz
    -rw-r----- 1 root    root     11K Sep 15 15:04 six-1.11.0-py2.py3-none-any.whl
    

    support@vrni-platform:~$ sudo pip install -U --force-reinstall --allow-unverified --find-links=/home/support/app_depen/ -r requirements.txt

    我得到下面的错误

    Collecting retrying==1.3.3 (from -r requirements.txt (line 2))
      Could not find a version that satisfies the requirement retrying==1.3.3 (from -r requirements.txt (line 2)) (from versions: )
    No matching distribution found for retrying==1.3.3 (from -r requirements.txt (line 2))
    

    我试着像下面这样更改权限。但仍然得到同样的错误

    support@vrni-platform:~$ ls -lah /home/support/app_depen/
    total 32K
    drwxrwx--- 2 support support 4.0K Sep 15 15:04 .
    drwx------ 5 support support 4.0K Sep 15 15:09 ..
    -rw-r-xr-x 1 root    root     11K Sep 15 15:04 retrying-1.3.3.tar.gz
    -rw-r----- 1 root    root     11K Sep 15 15:04 six-1.11.0-py2.py3-none-any.whl
    

    • Python-2.7.6版
    1 回复  |  直到 6 年前
        1
  •  3
  •   tuk    6 年前

    --find-links 内部 requirements.txt 像下面这样然后执行 sudo pip install -U -r requirements.txt

    --no-index
    --find-links /home/support/app_depen
    
    retrying==1.3.3
    six==1.11.0