如何在 python 中激活虚拟环境时使用 pip install

How to use pip install while activating virtual environment in python

我已经安装了一个单独的 python 版本并基于它激活了虚拟环境,在 CentOs7 当我使用离线包中的 pip install 方法时我得到了这个错误:

    ERROR: Command errored out with exit status 127:
     command: /home/awagdy/Documents/reporter-web/venv/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jlfbivgb/Django/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jlfbivgb/Django/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: /tmp/pip-install-jlfbivgb/Django/
    Complete output (1 lines):
    /home/awagdy/Documents/reporter-web/venv/bin/python3.7: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
    ----------------------------------------
ERROR: Command errored out with exit status 127: python setup.py egg_info Check the logs for full command output.

我正在从包含使用命令 pip download 下载的所需软件包的文件夹进行安装,然后使用 pip install -r requirements.txt --no--index --find-links=pkgs

离线安装它们

下面的link,本人建议使用 easy_install 在虚拟环境中安装 python 包时

example

使用这个命令有帮助path/to/python/python3.6 -m pip install -r requirements.txt --no-index --find-links=path/to/pkgs