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

时间:2018-09-15 15:21:13

标签: python python-2.7 pip

我正在尝试通过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

然后尝试通过如下所示的pip进行安装

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
  • PIP-7.1.2

1 个答案:

答案 0 :(得分:2)

--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