简体   繁体   English

安装软件包后出现“找不到模块”错误

[英]Getting a 'module not found' error after installing a package

I tried installing the deuces package in python using 我尝试使用在Python中安装deuces软件包

python -m pip install deuces

which installed perfectly. 完美安装。 But whenever I attempt to call upon the function, I get an error message: 但是,每当我尝试调用该函数时,都会收到错误消息:

Traceback (most recent call last): File "", line 1, in File "C:\\Python\\Anaconda\\lib\\site-packages\\deuces__init__.py", line 1, in from card import Card ModuleNotFoundError: No module named 'card' 追溯(最近一次通话最新):文件“”,行1,在文件“ C:\\ Python \\ Anaconda \\ lib \\ site-packages \\ deuces__init __。py”中,行1,来自卡导入Card ModuleNotFoundError:没有名为“卡'

Even though I can't find anything wrong with the module calling. 即使我在模块调用中找不到任何错误。 Would someone be able to check what's going wrong here? 有人可以检查这里出了什么问题吗?

PS: I did read the post Import Error Python: No module named 'card' but found no solution. PS:我确实阅读了“ 导入错误Python:没有名为'card'的模块”的文章,但没有找到解决方案。

在此处输入图片说明

It seems the package is using python 2 only relative imports here , which was removed py PEP 404 . 似乎该软件包在这里仅使用python 2相对导入,已从py PEP 404中删除。

These should be changed to either douces.xxx or relative imports .xxx . 这些应更改为douces.xxx或相对进口.xxx Currently, your best hope would be to make a PR to fix this, or to fork the library and fix it yourself. 当前,您最大的希望是制作PR来解决此问题,或者派出您自己修复的库。

You are most likely trying to run this code in Python 3. Sadly the deuces module's page in the PyPI repository does not make it clear that the module currently only appears to support Python 2, under which the module imports perfectly. 您最有可能尝试在Python 3中运行此代码。可惜的是,PyPI存储库中的deuces模块页面并未明确表明该模块当前仅支持Python 2,在该模块下该模块可以完美导入。

Since it doesn't look like the module has received much attention lately, if you want to run it under Python 3 you may end up doing the port yourself. 由于该模块最近看起来不太受关注,因此,如果要在Python 3下运行它,您可能最终自己进行移植。 It doesn't look as though it would take too much work. 看起来并不需要太多的工作。

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

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