【问题标题】:AWS Elastic Beanstalk Python: How to configure the environment to use selenium?AWS Elastic Beanstalk Python:如何配置环境以使用 selenium?
【发布时间】:2018-03-20 00:40:42
【问题描述】:

我有一个 AWS Elastic Beanstalk Python2.7 环境,我的应用程序使用 selenium。例如,它具有以下行

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

当我 ssh 到服务器并从那里运行代码时(安装所有必需的包之后),代码运行良好,但是当我打开服务 url 以通过网络服务器运行代码时,我收到以下错误

ImportError: No module named selenium.webdriver.common.desired_capabilities

我在 .ebextensions 下有一个名为 packages.config 的配置文件,内容如下

packages:
  python:
    selenium: []

服务器肯定会解析配置文件,因为当我在那里的文件格式错误时,它曾经无法部署。

【问题讨论】:

    标签: python amazon-web-services selenium amazon-ec2 amazon-elastic-beanstalk


    【解决方案1】:

    在应用程序根文件夹中添加您的 requirements.txt 并与您的应用程序一起部署。

    编辑:

    这变成了正确的答案,但是要添加到它,而不是自己创建 requirements.txt,如果你通过 pip 安装了所有东西,你可以使用 pip freeze >> requirements.txt 提取它

    【讨论】:

      猜你喜欢
      • 2020-12-08
      • 2020-02-05
      • 2016-12-10
      • 1970-01-01
      • 2021-09-29
      • 2015-01-22
      • 2018-04-01
      • 2019-09-01
      • 2015-08-05
      相关资源
      最近更新 更多