简体   繁体   English

pyinstaller 没有名为 pyinstaller 的模块

[英]pyinstaller No module named pyinstaller

I have 2 python versions installed under my mac osx sierra: python 3.5 python 2.7我在我的 mac osx sierra 下安装了 2 个 python 版本: python 3.5 python 2.7

I installed pyinstaller under python3.5 with this command:我用这个命令在python3.5下安装了pyinstaller:

python3.5 -m pip install pyinstaller

If I run again the same command I'm getting:如果我再次运行相同的命令,我会得到:

Requirement already satisfied: pyinstaller in./lib/python3.5/site-packages Requirement already satisfied: setuptools in./lib/python3.5/site-packages (from pyinstaller)要求已满足:pyinstaller in./lib/python3.5/site-packages 要求已满足:setuptools in./lib/python3.5/site-packages(来自 pyinstaller)

That to me means that is is installed under python 3.5 and ready to be used.这对我来说意味着它安装在 python 3.5 下并准备好使用。

When I run this command:当我运行此命令时:

python3.5 -m pyinstaller mypython35script.py

I'm getting: /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5: No module named pyinstaller我得到:/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5: No module named pyinstaller

Why?为什么? What I'm doing wrong?我做错了什么?

Their package name have caps in it (not sure if it's very PEP8 tho..).他们的包名中有大写(不确定它是否非常PEP8 tho ..)。 This should work if you can't find the pyinstaller executable script:如果您找不到pyinstaller可执行脚本,这应该可以工作:

python -m PyInstaller your_script.py 

I had same issue here, and i tried everything, but finally i found the solution :我在这里遇到了同样的问题,我尝试了一切,但最终我找到了解决方案:

在此处输入图片说明

I had to downgrade pip from version 19 to 18.1 :我不得不将 pip 从版本 19 降级到 18.1 :

pip install pip==18.1

Then install PyInstaller :然后安装 PyInstaller :

pip install pyinstaller

. .

As you see i managed to install it :如您所见,我设法安装了它: 在此处输入图片说明 . .

After that you can upgrade your pip again :之后,您可以再次升级您的 pip:

python -m pip install --upgrade pip

PyInstaller is case sensitive when being executed from the python3 - m method. PyInstaller 在从 python3 - m 方法执行时区分大小写。 You need to run it as follows.您需要按如下方式运行它。


python3 -m PyInstaller yourscript.py


If you want directly execute from the terminal you need to install it as follows.如果你想直接从终端执行,你需要如下安装它。


python3 -m pip install pyinstaller or pip3 install pyinstaller python3 -m pip install pyinstallerpip3 install pyinstaller


Following that, you need to set your global python executable to python3.之后,您需要将全局 python 可执行文件设置为 python3。


pyinstaller yourscript.py


I had the same trouble, so I tried to do as @mounirboulwafa says.我遇到了同样的麻烦,所以我试着按照@mounirboulwafa 说的去做。

I had to downgrade pip from version 19 to 18.1 :我不得不将 pip 从版本 19 降级到 18.1 :
pip install pip==18.1 pip 安装 pip==18.1

But I got this error again even during pip 18 install!但是即使在 pip 18 安装期间我也再次遇到此错误!

So I readed console logs again and saw some lines about user, permission etc. And tried to start cmd as admin , and repeat install pyinstaller.所以我再次阅读了控制台日志,看到了一些关于用户、权限等的行。并尝试以admin身份启动 cmd ,并重复安装 pyinstaller。

It works!它有效!

So typical thing surprisely resolved the sitation.如此典型的事情出人意料地解决了这个问题。 Hope it helps somebody.希望它可以帮助某人。

I had the same problem, turns out module names are CASE-SENSITIVE which I didn't know, so instead of cmd -我遇到了同样的问题,结果模块名称是区分大小写的,我不知道,所以不是 cmd -

python3.5 -m pyinstaller mypython35script.py

you're supposed to run你应该跑

python3.5 -m PyInstaller mypython35script.py

Turns out there was no issue with Installation as it showed结果显示安装没有问题

Requirement already satisfied: pyinstaller in ./lib/python3.5/site-packages Requirement already satisfied: setuptools in ./lib/python3.5/site-packages (from pyinstaller)

pip install searches for the module name in PyPi (Python Package Index) where case doesn't matter pip install 在 PyPi(Python 包索引)中搜索模块名称,其中大小写无关紧要

Please feel free to correct me or add comments as I am fairly new to Python and command line请随时纠正我或添加评论,因为我对Python命令行相当陌生

Finally, this version drops support for Python 2.7, which is end-of-life since January 2020.. The minimum required version is now Python 3.5.最后,此版本不再支持自 2020 年 1 月起停产的 Python 2.7。现在所需的最低版本为 Python 3.5。 The last version supporting Python 2.7 was PyInstaller 3.6.支持 Python 2.7 的最后一个版本是 PyInstaller 3.6。

pip install pyinstaller==3.6

So if anybody using python 2.7 version, Just install pyinstaller3.6 version and run it will work fine.因此,如果有人使用 python 2.7 版本,只需安装 pyinstaller3.6 版本并运行它就可以正常工作。

You should navigate into your scripts folder and open command window there (by clicking right mouse button while holding down shift key) and write in there:您应该导航到您的脚本文件夹并在那里打开命令窗口(通过在按住 shift 键的同时单击鼠标右键)并在其中写入:

pyinstaller mypython35script.py

If the script is in another location drag your script into the command window after typing pyinstaller.如果脚本位于其他位置,请在键入 pyinstaller 后将脚本拖到命令窗口中。 Hope this helps.希望这会有所帮助。

Right now the only way I found to make it works is to: navigate to:现在我发现让它工作的唯一方法是:导航到:

/Library/Frameworks/Python.framework/Versions/3.5/bin /Library/Frameworks/Python.framework/Versions/3.5/bin

run pyinstaller mypython35script.py运行 pyinstaller mypython35script.py

cheers d.干杯 d.

ps I still don't know why is not working in the way I described in my first post. ps 我仍然不知道为什么不能按照我在第一篇文章中描述的方式工作。

Rename your pyinstaller to pyinstaller35 and also rename your pyinstaller-script.py to pyinstaller35-script.py inside the scripts directory which is inside the python3.5 installation directory.将您的 pyinstaller 重命名为 pyinstaller35 并将您的 pyinstaller-script.py 重命名为 pyinstaller35-script.py 在 python3.5 安装目录内的脚本目录中。 Now add the scripts directory to the system path.现在将脚本目录添加到系统路径。 Now you can run it as pyinstaller35 yourfile.py -F现在您可以将其作为pyinstaller35 yourfile.py -F运行

From Anaconda prompt the following works for me.从 Anaconda 提示以下对我有用。 Run the following command after navigating to the location of the module导航到模块所在的位置后运行以下命令

pyinstaller --onefile mypython35script.py

在我的情况下,我只是在管理员模式下打开 cmd 并重新运行下面的 cmd 并且它起作用了。

pip install pyinstaller

This works in my case with pip version 19.0.1这适用于我的 pip 版本 19.0.1

cmd => rightclick => with admin rights

Enter in cmd: "pip install pyinstaller"

PyInstaller having issues with pip 19.0 ( https://github.com/pyinstaller/pyinstaller/issues/4003 ) PyInstaller 有 pip 19.0 问题( https://github.com/pyinstaller/pyinstaller/issues/4003

Downgrade pip to 18.1 version works fine.将 pip 降级到 18.1 版本工作正常。

None of the solutions have worked for me so i tried to uninstall pyinstaller via the command没有一个解决方案对我有用,所以我尝试通过命令卸载 pyinstaller

py -m pip uninstall pyinstaller py -m pip 卸载 pyinstaller

The last path they gave was a path to the script "pyinstaller.exe".他们给出的最后一个路径是脚本“pyinstaller.exe”的路径。 So all I did was drag and drop and it worked!所以我所做的只是拖放,它奏效了!

You need to go to the file that your .py is, and pyinstaller need to be capitalized like this "PyInstaller"您需要转到 .py 所在的文件,并且 pyinstaller 需要大写,例如“PyInstaller”

Full command: python -m PyInstaller --onefile [yourfile.py]完整命令: python -m PyInstaller --onefile [yourfile.py]

Put -w behind the --onefile if you want on console file如果需要在控制台文件中,将-w放在--onefile后面

After some research as of 12/20/2022 it seems to be not supported for my py version 3.10经过 12/20/2022 的一些研究后,我的 py 版本3.10似乎不受支持

Python: 3.7-3.11.蟒蛇:3.7-3.11。 Note that Python 3.10.0 contains a bug making it unsupportable by PyInstaller.请注意,Python 3.10.0 包含一个错误,导致 PyInstaller 无法支持它。 PyInstaller will also not work with beta releases of Python 3.12. PyInstaller 也不适用于 Python 3.12 的测试版。 https://github.com/pyinstaller/pyinstaller https://github.com/pyinstaller/pyinstaller

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM