gpt4 book ai didi

python 2.7 虚拟环境-没有名为 lxml.objectify 的模块

转载 作者:太空宇宙 更新时间:2023-11-04 00:30:12 54 4
gpt4 key购买 nike

我在 Windows 环境下的 Google App Engine 沙箱上将 virtualenv 与 Python 2.7 一起用于 Django 项目。我尝试使用这个 amazon api library这需要 lxml 作为依赖项。

安装 lxml(和所有其他依赖项)并尝试导入 amazon api 模块后,出现以下错误:

ImportError: No module named lxml.objectify

objectify 模块存在于正确的文件夹中。我在网上搜索了一个解决方案,发现在 Windows 上安装 lxml 会很痛苦,但找不到解决方案。

我已经尝试过的:

  • 卸载和安装 lxml
  • 安装版本 3.8.0 和 3.7.3
  • 将 lxml 安装为 pip 或二进制安装程序
  • 从 whl 包安装 lxml

有人遇到过这个问题并能够解决吗?

干杯!

最佳答案

lxml 是 App Engine 的 built-in third party libraries 之一.

要使用它,您需要:

将其添加到您的 app.yaml file 的库指令中:

libraries:
- name: lxml
version: 3.7.3

Install it locally using pip ,因为它不包含在 SDK 中:

pip install lxml==3.7.3

或通过 vendoring process 安装.

pip install --target lib lxml==3.7.3

如果 lxml 没有被添加到 app.yaml 你会看到开发服务器会报告一个 ImportError,不管 如何lxml 已安装。

关于python 2.7 虚拟环境-没有名为 lxml.objectify 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46105103/

54 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com