如何根据本地目录中的requirements.txt文件使用pip安装软件包?

*爱你&永不变心* 提交于 2020-08-08 22:58:06

问题:

Here is the problem 这是问题所在

I have a requirements.txt that looks like: 我有一个require.txt看起来像:

BeautifulSoup==3.2.0
Django==1.3
Fabric==1.2.0
Jinja2==2.5.5
PyYAML==3.09
Pygments==1.4
SQLAlchemy==0.7.1
South==0.7.3
amqplib==0.6.1
anyjson==0.3
...

I have a local archive directory containing all the packages + others. 我有一个本地存档目录,其中包含所有软件包和其他软件包。

I have created a new virtualenv with 我创建了一个新的virtualenv

bin/virtualenv testing

upon activating it, I tried to install the packages according to requirements.txt from the local archive directory. 激活它后,我尝试根据本地存档目录中的requirements.txt安装软件包。

source bin/activate
pip install -r /path/to/requirements.txt -f file:///path/to/archive/

I got some output that seems to indicate that the installation is fine 我得到一些输出,似乎表明安装正常

Downloading/unpacking Fabric==1.2.0 (from -r ../testing/requirements.txt (line 3))
  Running setup.py egg_info for package Fabric
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    warning: no files found matching 'fabfile.py'
Downloading/unpacking South==0.7.3 (from -r ../testing/requirements.txt (line 8))
  Running setup.py egg_info for package South
....

But later check revealed none of the package is installed properly. 但后来检查发现该软件包均未正确安装。 I cannot import the package, and none is found in the site-packages directory of my virtualenv. 我无法导入软件包,但在virtualenv的site-packages目录中找不到任何软件包。 So what went wrong? 那么出了什么问题?


解决方案:

参考一: https://stackoom.com/question/UJmm/如何根据本地目录中的requirements-txt文件使用pip安装软件包
参考二: https://oldbug.net/q/UJmm/How-to-install-packages-using-pip-according-to-the-requirements-txt-file-from-a-local-directory
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!