linux - 如何运行,带有外部库的 python 脚本,并且只使用 venv
问题描述
我在python2.7 + rrdtool lib上写了一些主机监控脚本。我有一个问题:“当我没有在 linux 上安装 pip 时如何使用外部库运行 python 脚本”,“外部库”我的意思是不是标准库安装了 python 2.7。
- 我尝试使用 python 虚拟 python-virtual-environments
- 我也尝试使用 activate_this.py
- 我尝试使用 env 目录中的 pip 但我有错误 - bad python bad interpreter: no such file or directory
我的主要问题是如何仅从 python-virtual-environments 使用 python 和 pip,而不使用系统 python 和系统库。
GitHub 代码链接:https ://github.com/ArtemKyrylov/Internet_monitor
解决方案
复制 Internet_monitor/python-virtual-environments/env/lib/python2.7 中的库并将其导入您的 python 脚本
推荐阅读
- python-3.x - 如何在 python 3.x 中的输入后面打印文本
- javascript - 在 Chrome 扩展中的 if 语句之后没有运行函数
- reactjs - 如何在 Ant Design 表单中实现响应式布局?
- azure-devops - 如何通过 UniversalPackages 将包上传到 Azure devops pipline 中的外部私有 noarch 存储库
- php - 为什么我的产出价值翻了一番?如何在不加倍的情况下存储每个文件的确切值?
- python - 无法仅在一台机器上打开 Python 中的共享库
- r - R Shiny中表格下方的中心表格
- python - 如何在 docker 容器中使用 Python 的 webbrowser.get
- javascript - 数组中单词列表中具有特定第一个和最后一个字母的单词(node.js)
- r - 在 R 中,是否可以在矩阵中使用对、元组或等价物?