mit Anaconda 2.5.0 (Python 2.7) auf einem relativ sauberen Ubuntu 15.04 Desktop-System, habe ich folgendes ungewöhnliches Verhalten:PYTHONPATH beeinflussen BASH Suchpfad
Wenn ich mit cx_Freeze 4.3.4 meine Anwendung verpacken und fügen Sie die bin Verzeichnis der Umgebungsvariablen PYTHONPATH:
export PYTHONPATH=~/frozen-app/bin
Dann, als ich ein bash-Befehl vertippen:
sl
Statt der erwarteten:
The program 'sl' is currently not installed. You can install it by typing:
sudo apt-get install sl
ich einen Python-Stack-Trace:
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 23, in <module>
import gettext
File "/usr/lib/python3.4/gettext.py", line 49, in <module>
import locale, copy, io, os, re, struct, sys
File "/usr/lib/python3.4/locale.py", line 18, in <module>
import collections
File "/usr/lib/python3.4/collections/__init__.py", line 11, in <module>
from operator import itemgetter as _itemgetter, eq as _eq
ImportError: dynamic module does not define init function (PyInit_operator)
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 62, in apport_excepthook
import re, traceback
File "/usr/lib/python3.4/traceback.py", line 3, in <module>
import linecache
File "/usr/lib/python3.4/linecache.py", line 10, in <module>
import tokenize
File "/usr/lib/python3.4/tokenize.py", line 29, in <module>
import collections
File "/usr/lib/python3.4/collections/__init__.py", line 11, in <module>
from operator import itemgetter as _itemgetter, eq as _eq
ImportError: dynamic module does not define init function (PyInit_operator)
Original exception was:
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 23, in <module>
import gettext
File "/usr/lib/python3.4/gettext.py", line 49, in <module>
import locale, copy, io, os, re, struct, sys
File "/usr/lib/python3.4/locale.py", line 18, in <module>
import collections
File "/usr/lib/python3.4/collections/__init__.py", line 11, in <module>
from operator import itemgetter as _itemgetter, eq as _eq
ImportError: dynamic module does not define init function (PyInit_operator)
Es scheint, dass der "command-not-found" Befehl von meiner PYTHONPATH Umgebung durcheinander, aber ich kann genau, warum nicht herausgefunden. Ich glaube nicht, dass eines der genannten Module in meiner Anwendung definiert ist (ich definiere kein "Re" Modul in meiner App).
Wenn ich "strace sl" ausführen, dann bekomme ich nur "kann nicht stat sl". Gibt es eine andere Möglichkeit, genau herauszufinden, welche Datei in meiner Anwendung das verursacht?
'PS4 = ': $ {BASH_SOURCE}: $ {LINENO} +'', dann 'set -x' und dann' sl'. –
Die "erwartete" Ausgabe stammt von einem anderen Befehl, den die Shell ausführt, wenn sie auf einen fehlenden Befehl stößt. Wird dieser Befehl in Ubuntu zufällig in Python geschrieben? – chepner
@chepner, ich denke, das OP weiß das - sie beziehen sich schließlich auf den Befehl Befehl nicht gefunden. –