Can't compile Python using Nuitka

萝らか妹 提交于 2019-12-10 12:49:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!