简体   繁体   English

python 2.7 virtual env-没有名为lxml.objectify的模块

[英]python 2.7 virtual env - No module named lxml.objectify

I'm using virtualenv with Python 2.7 for a Django project, on Google App Engine sandbox on Windows environment. 我在Windows环境下的Google App Engine沙箱上将virtualenv与Python 2.7一起用于Django项目。 I try to use this amazon api library which requires lxml as a dependency. 我尝试使用需要lxml作为依赖项的亚马逊api库

After installing lxml (and all other dependencies) and trying to import amazon api module, I'm getting the following error: 安装lxml(和所有其他依赖项)并尝试导入Amazon api模块后,出现以下错误:

ImportError: No module named lxml.objectify ImportError:没有名为lxml.objectify的模块

objectify module exists in the correct folder. objectify模块存在于正确的文件夹中。 I searched online for a solution and saw that installing lxml on Windows can be pain in the ass, but couldn't find a solution. 我在网上搜索了一个解决方案,结果发现在Windows上安装lxml可能会很麻烦,但找不到解决方案。

What I already tried: 我已经尝试过的

  • Uninstalling and installing lxml 卸载和安装lxml
  • Installing version 3.8.0 and 3.7.3 安装版本3.8.0和3.7.3
  • Installing lxml as pip or binary installer 将LXML安装为pip或二进制安装程序
  • Installing lxml from whl package 从Whl软件包安装LXML

Did someone faced this issue and was able to solve it? 有人遇到过这个问题并能够解决吗?

Cheers! 干杯!

lxml is one of App Engine's built-in third party libraries . lxml是App Engine的内置第三方库之一

To use it, you need to: 要使用它,您需要:

add it to the libraries directive of your app.yaml file : 将其添加到您的app.yaml文件的libraries指令中:

libraries:
- name: lxml
  version: 3.7.3

and Install it locally using pip , because it's not included in the SDK: 使用pip在本地安装 ,因为它不包含在SDK中:

pip install lxml==3.7.3

or install via the vendoring process . 或通过供应商过程进行安装。

pip install --target lib lxml==3.7.3

If lxml is not added to app.yaml you will see the dev server will report an ImportError , regardless of how lxml was installed. 如果没有将lxml添加到app.yaml ,则无论lxml安装方式如何,开发服务器都会报告一个ImportError

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM