Jump to content

Python Tree Program: multiple children: module error


zak100

Recommended Posts

Hi,

I am trying to run th efollowing program, I got it from :Tree with Multiple children

 

from anytree import Node, RenderTree

udo = Node("Udo")
marc = Node("Marc", parent=udo)
lian = Node("Lian", parent=marc)
dan = Node("Dan", parent=udo)
jet = Node("Jet", parent=dan)
jan = Node("Jan", parent=dan)
joe = Node("Joe", parent=dan)

 

I am getting th efollowing error:

File "PycharmProjects/AIHW/venv/TreeDS.py", line 1, in <module>
    from anytree import Node, RenderTree
ModuleNotFoundError: No module named 'anytree'

 

Somebody please guide me.

 

Zulfi.

Link to comment
Share on other sites

Hi,

Thanks for your response.

$ pip install anytree


 

Quote

Collecting anytree
  Downloading https://files.pythonhosted.org/packages/a8/65/be23d8c3ecd68d40541d49812cd94ed0f3ee37eb88669ca15df0e43daed1/anytree-2.8.0-py2.py3-none-any.whl (41kB)
    100% |████████████████████████████████| 51kB 712kB/s
Collecting six>=1.9.0 (from anytree)
  Cache entry deserialization failed, entry ignored
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Installing collected packages: six, anytree
Successfully installed anytree-2.8.0 six-1.15.0

But still I am getting the same error.

'Hint' is changing

from anytree import Node, RenderTree

to

import anytree

but its not doing any good to my code.

Somebody please guide me.

Some

Zulfi.

Link to comment
Share on other sites

7 minutes ago, zak100 said:

Hi,

Thanks for your response.


$ pip install anytree


 

But still I am getting the same error.

'Hint' is changing


from anytree import Node, RenderTree

to


import anytree

but its not doing any good to my code.

Somebody please guide me.

Some

Zulfi.

Do you have multiple Python installations? The installation you just did in the shell would be in whatever Python installation path you have in the system PATH variable if you're using Windows, so you should be fine if you run the Python script from the Shell. If you're using an IDE it might be using a different Python path.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.