Skip to content Skip to sidebar Skip to footer

Import Error Python: No Module Named 'card'

I've spent the majority of the day trying to troubleshoot this issue. So I'm trying to import the 'deuces' package from github. However, I keep getting an error: !python Python 3.

Solution 1:

I have created a fork of deuces that supports Python 3.

$ pip install treys

And you can use it with the new name:

>>> from treys import Card

Solution 2:

deuces hasn't been ported to Python 3 yet, I suspect.


Solution 3:

TL;DR

>>> from deuces.deuces.card import Card 

Explanation...

1) Import the module
You missed a level in the directory structure.

>>> import deuces.deuces.card as card

or

>>> from deuces.deuces import card

Levels...

>>> import deuces             # Module
>>> import deuces.deuces      # Sub-module
>>> import deuces.deuces.card # card.py

2) Use the class from the module

Now that you have the module (card, lowercase), if you want to access the class (Card), simply card.Card.


Post a Comment for "Import Error Python: No Module Named 'card'"