Seite 1 von 1
Import treelib error
Verfasst: Samstag 8. April 2017, 09:36
von ChrisInfo17
Erstmal ein Hallo an Alle,
ich bin neu hier im Forum, aber nicht mehr ganz zu Python.
Leider hab ich gerade ein Problem mit dem Modul treelib, welches ich in einem Programm verwende möchte.
Zum Importieren der Module hab ich bis jetzt pip oder easyInstaller benutz. Nur dieses mal scheint es nicht zu funktionieren. Mein System ist ein XUbuntu 16.04 und ich benutze den Befehl sudo easy_install -U treelib.
DIes wird auch erfolgreich abgeschlossen.
Wenn ich nun aber mit dem Befehl pip freeze alle Packets anzeigen lasse ist es nicht dabei und das Programm funktioniert auch nicht bricht mit einem Import Error von treelib ab, Zur Sicherheit hab ich es noch mit sudo pip install treelib versucht , hat aber nicht geholfen.
Vielen Dank für eure Hilfe
Viele Grüße
Chris
Re: Import treelib error
Verfasst: Samstag 8. April 2017, 11:28
von __deets__
Klingt fuer mich erstmal nach einem Python Versionskonflikt. Bist du sicher, dass du nicht fuer Python 2 installierst, aber dann Python 3 benutzt (oder umgekehrt?)
Re: Import treelib error
Verfasst: Samstag 8. April 2017, 11:45
von BlackJack
Bei mir funktioniert die Installation mit ``pip`` und das taucht auch bei ``pip freeze`` in der Liste auf. :K
Re: Import treelib error
Verfasst: Samstag 8. April 2017, 15:28
von ChrisInfo17
Erst einmal vielen Dank für eure Antworten.
Leider iritiert mich das mit dem Pip immer noch
Gibt es für jede Python version ein anderes?
Ich hab das Programm mit Python, Python2.7 und Python3.5 aufgerufen.
Nun hab ich mir einen Virtuele umgebung eingebaut in der Hoffung das würde etwas änderen aber jetzt bekomm ich ein ganz anderen Fehler
Code: Alles auswählen
(tree) info@info:~/EinfuehrungInformatik/virualEnviroments/tree$ sudo -H pip install libtree
Collecting libtree
Using cached libtree-6.0.1.tar.gz
Collecting psycopg2==2.6.1 (from libtree)
Using cached psycopg2-2.6.1.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-uYaBGA/psycopg2/
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(tree) info@info:~/EinfuehrungInformatik/virualEnviroments/tree$ pip --version
pip 9.0.1 from /home/info/EinfuehrungInformatik/virualEnviroments/tree/lib/python2.7/site-packages (python 2.7)
(tree) info@info:~/EinfuehrungInformatik/virualEnviroments/tree$
Weiß jemand was ich falsch mache ?
Re: Import treelib error
Verfasst: Samstag 8. April 2017, 16:44
von ChrisInfo17
Ich hab es jetzt irgendwie geschafft, dass das Modul bei pip freeze erscheint, aber leider bekomm ich immer noch den Fehler
Code: Alles auswählen
(tree) info@info:~/EinfuehrungInformatik/virualEnviroments/tree$ pip freeze
appdirs==1.4.3
libtree==6.0.1
packaging==16.8
pkg-resources==0.0.0
psycopg2==2.6.1
pyparsing==2.2.0
six==1.10.0
(tree) info@info:~/EinfuehrungInformatik/virualEnviroments/tree$ python libree.py
Traceback (most recent call last):
File "libree.py", line 2, in <module>
from treelib import Node, Tree
ImportError: No module named treelib
(tree) info@info:~/EinfuehrungInformatik/virualEnviroments/tree$ python2.7 libree.py
Traceback (most recent call last):
File "libree.py", line 2, in <module>
from treelib import Node, Tree
ImportError: No module named treelib
Ich bedanke mich schon mal für jede Hilfe
Re: Import treelib error
Verfasst: Samstag 8. April 2017, 16:46
von BlackJack
@ChrisInfo17: Wenn Du ein virtualenv hast, dann willst Du *dort* hinein installieren und nicht mit ``sudo`` systemweit.
Und was möchtest Du denn da eigentlich installieren? Wir gingen bisher von `treelib` aus, denn das steht im Betreff und bis gerade eben zumindest auch im Text, nun ist es aber plötzlich `libtree`‽
Re: Import treelib error
Verfasst: Samstag 8. April 2017, 17:55
von ChrisInfo17
oh ja da sollte ich aufpassen. Ich meine natürlich treelib, das ist nun auch in der Liste es wird aber die Klasse
Tree nicht gefunden
Code: Alles auswählen
(tree) info@info:~/EinfuehrungInformatik/virualEnviroments/tree$ vim treelib.py
(tree) info@info:~/EinfuehrungInformatik/virualEnviroments/tree$ python3 treelib.py
Traceback (most recent call last):
File "treelib.py", line 1, in <module>
from treelib import Tree
File "/home/info/EinfuehrungInformatik/virualEnviroments/tree/treelib.py", line 1, in <module>
from treelib import Tree
ImportError: cannot import name 'Tree'
(tree) info@info:~/EinfuehrungInformatik/virualEnviroments/tree$ pip freeze
appdirs==1.4.3
libtree==6.0.1
packaging==16.8
pkg-resources==0.0.0
psycopg2==2.6.1
pyparsing==2.2.0
six==1.10.0
treelib==1.3.5
(tree) info@info:~/EinfuehrungInformatik/virualEnviroments/tree$
Sorry jetzt kann ich es gar nicht mehr verstehen
Re: Import treelib error
Verfasst: Samstag 8. April 2017, 19:12
von BlackJack
@ChrisInfo17: Du hast Dein eigenes Modul `treelib` genannt. Und da gibt's kein `Tree`.
Re: Import treelib error
Verfasst: Samstag 8. April 2017, 19:56
von ChrisInfo17
oh ja stimmt daran hab ich gar nicht gedacht,
da hätte ich noch lange suchen können
Vielen Dank