首页 > 解决方案 > 如何运行,带有外部库的 python 脚本,并且只使用 venv

问题描述

我在python2.7 + rrdtool lib上写了一些主机监控脚本。我有一个问题:“当我没有在 linux 上安装 pip 时如何使用外部库运行 python 脚本”,“外部库”我的意思是不是标准库安装了 python 2.7。

  1. 我尝试使用 python 虚拟 python-virtual-environments
  2. 我也尝试使用 activate_this.py
  3. 我尝试使用 env 目录中的 pip 但我有错误 - bad python bad interpreter: no such file or directory

我的主要问题是如何仅从 python-virtual-environments 使用 python 和 pip,而不使用系统 python 和系统库。

GitHub 代码链接:https ://github.com/ArtemKyrylov/Internet_monitor

标签: linuxpython-2.7pipvirtualenv

解决方案


复制 Internet_monitor/python-virtual-environments/env/lib/python2.7 中的库并将其导入您的 python 脚本


推荐阅读