gpt4 book ai didi

python - 在 Anaconda Python 中找不到测试模块

转载 作者:太空宇宙 更新时间:2023-11-03 17:36:57 25 4
gpt4 key购买 nike

我在 Anaconda 的 Python 版本中找不到 test 模块。谁能帮我解决这个问题。我尝试使用的 dpkt 库使用此模块。

Python 2.7.8 |Anaconda 2.1.0 (x86_64)| (default, Aug 21 2014, 15:21:46)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import test
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named test

最佳答案

快速修复:您可以从 cpython github repository check out pystone.py 的副本并将其复制到 PYTHONPATH 中的 test 目录。或者您可以将其复制到 python 项目根目录中的 test 目录(丑陋的方式)。

也许 Anaconda Python 并未附带 test 模块的副本。这是Python 2.7 的标准部分。有时,用户会意外地用其他内容覆盖其 Python 标准库的 test 模块。您可以尝试使用 OS X 附带的 Python 版本。如果也失败,则尝试查看正在加载哪个 test 模块,然后从那里开始。

import test
print test

关于python - 在 Anaconda Python 中找不到测试模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31083913/

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