问题
I'm trying to compile Python file which uses urllib.request, BeautifulSoup, and webbrowser.
$ nuitka python.py
Nuitka:WARNING:python.py:16: Cannot find 'urllib.request' as relative or absolute import.
Nuitka:WARNING:python.py:17: Cannot find 'bs4' as relative or absolute import.
$ ./python.exe
Traceback (most recent call last):
File "python.py", line 16, in <module>
from urllib.request import urlopen
ImportError: No module named request
回答1:
I got some similar looking error messages. Did you install both Python2 and Python3? It solved the problem for me.
(Installing both versions is neccessary as mentioned here: http://nuitka.net/doc/user-manual.html, section "Python3, yes but Python2 compile time dependency")
回答2:
Try to add --recurse-to=urllib
to command line during Nuitka execution.
See Nuitka help for details.
来源:https://stackoverflow.com/questions/34841288/cant-compile-python-using-nuitka