缺少模块Pyinstaller

时间:2018-02-16 22:49:32

标签: python

我一直在尝试使用pyinstaller将.py转换为.exe,正如您从标题中看到的那样.. .exe文件无法正常执行..它说它找不到模块(numpy)。所以我做了一些研究,发现pyinstaller在查找模块时遇到困难。 Pyinstaller网站:

pyi-makespec --paths = / path / to / thisdir \              --paths = / path / to / otherdir myscript.py

上面的代码可以帮助pyinstaller找到它们。我的问题是: 我的库在哪个目录中? (如numpy,pandas等) 这会是一个不同的代码吗?或者我会将其添加到我的代码中?或者这会在这行'pyinstaller myscript.py'中某处? 感谢

1 个答案:

答案 0 :(得分:1)

即时99.9999%确定pyinstaller已经有numpy的挂钩

只需在import numpy

的顶部添加myscript.py即可

并运行pyinstaller --onefile myscript.py && .\dist\myscript.exe

但要回答你的问题,请查看python文件夹的site-packages文件夹(键入which python以查找您的python版本)或which pyinstaller以查看您的pyinstaller位置(它应该与which python但在脚本文件夹中)

它曾经位于C:\ PythonX.Y \ Lib \

3.X中的

通常位于AppData文件夹

相关问题