I have the following program:
#!/usr/local/bin/python3
print(\"Hello\")
Via terminal I do test.py
and I get:
You might see ImportError: No module named '_sysconfigdata_m'
because /usr/lib/command-not-found
is broken on your system due to the ubuntu bug.
To workaround it, run ./test.py
, not test.py
-- the current directory is not in $PATH
usually (due to security reasons) and therefore you should specify the path explicitly otherwise the command is not found that may lead to trying to run /usr/lib/command-not-found
that results in the ImportError
.
If ./test.py
fails with the same error then check that there is no '\r\v\f' (unexpected whitespace) in the shebang (print(repr(open('test.py', 'rb').readline()))
). If test.py
uses Windows newlines then the attempt to find '/usr/local/bin/python3\r'
(notice: '\r'
due to '\r\n'
newline) is likely to fail that may trigger the error.