简体   繁体   English

无法在Python 2.7上导入cElementTree

[英]Can't import cElementTree on Python 2.7

I cannot import xml.etree.cElementTree on Python 2.7. 我无法在Python 2.7上导入xml.etree.cElementTree On the web, it says its already implemented, so I don't have to install it. 在网络上,它说它已经实现了,所以我不必安装它。 (It's working on Python 3.6 for me, but I need 2.7 for reasons here) (对我来说,它在Python 3.6上工作,但出于这里的原因,我需要2.7)

Thats the console output: 那是控制台输出:

Python 2.7.15+ (default, Nov 27 2018, 23:36:35) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.etree.cElementTree
Failed to import cElementTree from any known place
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named etree.cElementTree

I hope you can help me. 我希望你能帮助我。

Kind regards, Markus 亲切的问候,马库斯

I just found out that theres an old xml.pyc file in that directory, which didnt show up in PyCharm. 我刚刚发现该目录中有一个旧的xml.pyc文件,该文件未显示在PyCharm中。 It stopped the "real" XML from loading. 它停止了“真实” XML的加载。

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

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