简体   繁体   English

如何修复“auto-py-to-exe”不被识别为内部或外部命令、可运行程序或批处理文件

[英]how to fix 'auto-py-to-exe' is not recognized as an internal or external command, operable program or batch file

I have python 3.9 I used the command 'pip install auto-py-to-exe' and it downloaded but when I tried to using the command 'auto-py-to-exe' the program just said " 'auto-py-to-exe' is not recognized as an internal or external command, operable program or batch file.".我有 python 3.9 我使用了命令“pip install auto-py-to-exe”并下载了它,但是当我尝试使用命令“auto-py-to-exe”时,程序只是说“'auto-py-to -exe' 不是内部或外部命令,也不是可运行的程序或批处理文件。”。 I have the latest version of PIP and I also have PATH.我有最新版本的 PIP,我也有 PATH。 What can I do to fix this?我该怎么做才能解决这个问题?

First you need to type in the terminal (not Python):首先,您需要在终端中输入(不是 Python):

auto-py-to-exe 

If you are currently in python use exit() to exit then try the above code.如果您当前在 python 使用 exit() 退出然后尝试上面的代码。

It Depends on in which environment you have installed这取决于您安装在哪个环境中

Make sure to replace {User} with your user确保将 {User} 替换为您的用户

In Conda Enviournment go to below location Manually在 Conda Enviournment go 到以下位置手动

C:\Users\{User}\anaconda3\Scripts\auto-py-to-exe.exe

In Pip, Environment go to the location below在 Pip,环境 go 到下面的位置

C:\Users\{User}\AppData\Local\Programs\Python\Python37-32\Scripts\auto-py-to-exe.exe

or you can add this path to your environment variable as well for accessing these from anywhere或者您也可以将此路径添加到您的环境变量中,以便从任何地方访问它们

python -m auto_py_to_exe

Hope this help you: :D希望这对你有帮助::D
(I tried this on VSCode) (我在 VSCode 上试过这个)

First check you installed it首先检查你是否安装了它

pip install auto-py-to-exe

then restart your vscode and check another time.然后重新启动您的vscode并再次检查。 If still an error, check it in CMD.如果仍然有错误,请在 CMD 中检查。

As suggested above use:如上所述使用:

pip show --files auto-py-to-exe to find out in what directory pip has installed the scripts. pip show --files auto-py-to-exe 查看 pip 安装脚本的目录。 Double check the directory is in %PATH%仔细检查目录是否在 %PATH%

This will show you where the installer has placed the binary files.这将显示安装程序放置二进制文件的位置。 I then changed to that directory which circumvents any path issue.然后我更改为绕过任何路径问题的目录。 I tried to run the files and found:我试图运行这些文件并发现:

OSError: [WinError 1920] The file cannot be accessed by the system: 'C:\\Users\\aaaa\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\\python.exe'
PS C:\users\aaaa\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\Scripts>

In my case, although I haven't worked out how to fix it yet... It would seem to be trying to refer to an incorrect Python executable, the files in that directory are all 0 length.就我而言,虽然我还没有弄清楚如何修复它......它似乎试图引用一个不正确的 Python 可执行文件,该目录中的文件都是 0 长度。 Unfortunately the "python -m" suggestion didn't work for me, so it's back to the drawing board.不幸的是,“python -m”的建议对我不起作用,所以它又回到了绘图板上。 Hope that helps you confirm if it's the right solution to chase down.希望这可以帮助您确认它是否是追赶的正确解决方案。

If I install "auto-py-to-exe" using following command, as described in this link as well as from the comment from Justin Ezequiel (above):如果我使用以下命令安装“auto-py-to-exe”, 如此链接以及 Justin Ezequiel 的评论中所述(上图):

python -m pip install auto-py-to-exe

I am able to run it (in Windows 10) using following command:我可以使用以下命令运行它(在 Windows 10 中):

python -m auto_py_to_exe

You need to make sure you have typed cd C:\Users\your_user_name\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts as a separate command, and then auto-py-to-exe with python 3. Check in file explorer to make sure your path is correct if the cd fails.您需要确保已键入 cd C:\Users\your_user_name\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\alocal-packages 然后将 auto-39-toLocalCache\alocal-packages 命令和 auto-39-toLocalCache\alocal-packages\Python -exe with python 3. 如果 cd 失败,请检查文件资源管理器以确保您的路径正确。

This gave me quite a bit of trouble, as none of the above solutions worked for me.这给我带来了很多麻烦,因为上述解决方案都不适合我。 Spent lots of time trying to figure out what I should be adding to PATH with no success.花了很多时间试图弄清楚我应该向 PATH 添加什么但没有成功。

My issue stemmed from (I think) the fact that I have been using python downloaded from the windows store, which uses a different location to store python in.我的问题源于(我认为)我一直在使用从 windows 商店下载的 python,它使用不同的位置来存储 python。

With the manual install of python ( https://www.python.org ) you can specify where python is downloaded and automatically add that location to path.通过手动安装 python ( https://www.python.org ),您可以指定 python 的下载位置并自动将该位置添加到路径中。

Steps I took to solve the problem:我为解决问题所采取的步骤:

  1. Uninstall all versions of python downloaded from the windows store via settings (settings > apps > python > uninstall)通过设置卸载从 windows 商店下载的所有版本的 python(设置 > 应用程序 > python > 卸载)

  2. Uninstall all version of python via the control panel (control panel > add or remove programs > python xxx > uninstall)通过控制面板卸载python所有版本(控制面板>添加或删除程序>python xxx>卸载)

  3. Uninstall auto-py-to-exe ( pip uninstall auto-py-to-exe ) in case it didnt do that automatically卸载 auto-py-to-exe ( pip uninstall auto-py-to-exe ) 以防它没有自动执行

  4. Install python from python.org.从 python.org 安装 python。 (auto-py-to-exe is not supported in versions greater than 3.10 as of 1/23/2023). (自 2023 年 1 月 23 日起,3.10 以上的版本不支持 auto-py-to-exe)。 So I installed Python 3.10所以我安装了 Python 3.10

  5. The settings which were successful for me were: Custom installation, check install python for all users, check add to path, input 'C:\Python310' (with the respective version number) for install location, install对我来说成功的设置是:自定义安装,选中为所有用户安装 python,选中添加到路径,输入“C:\Python310”(带有相应的版本号)作为安装位置,安装

  6. Check new python version has been installed python --version检查新的 python 版本已经安装python --version

  7. Check pip is installed pip --version检查 pip 是否已安装pip --version

  8. Install auto-py-to-exe pip install auto-py-to-exe安装自动py-to-exe pip install auto-py-to-exe

When auto-py-to-exe finishes installing, scroll up through the install info and make sure there are no warnings that state there is a location not found in PATH.当 auto-py-to-exe 完成安装时,向上滚动安装信息并确保没有警告 state 在 PATH 中找不到位置。 If there are, you'll have to do some other research on adding those locations to PATH appropriately (since I don't think I was doing that right).如果有,您将不得不做一些其他研究以适当地将这些位置添加到 PATH (因为我认为我做的不对)。

Assuming no PATH warnings, 9. Run auto-py-to-exe假设没有 PATH 警告,9. 运行auto-py-to-exe

暂无
暂无

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

相关问题 如何解决错误“'py.exe'不被识别为内部或外部命令,可操作程序或批处理文件”的错误? - How to fix error “'py.exe' is not recognized as an internal or external command, operable program or batch file”? 如何修复“py”未被识别为内部或外部命令、可运行程序或批处理文件 - How to fix 'py' is not recognized as an internal or external command, operable program or batch file 如何修复错误:“make”不是内部或外部命令、可运行程序或批处理文件 - How to fix error : 'make' is not recognized as an internal or external command, operable program or batch file py 未被识别为内部或外部可运行程序或批处理文件 - py is not recognized as an internal or external operable program or batch file 无法将pycrypto'chmod'的setup.py install运行为内部或外部命令,可操作程序或批处理文件 - Running setup.py install for pycrypto 'chmod' is not recognized as an internal or external command, operable program or batch file 'py.test' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'py.test' is not recognized as an internal or external command, operable program or batch file pipenv-无法将“ pew”识别为内部或外部命令,可操作程序或批处理文件 - pipenv - 'pew' is not recognized as an internal or external command, operable program or batch file 'kedro' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'kedro' is not recognized as an internal or external command, operable program or batch file conda 不是内部或外部命令,也不是可运行的程序或批处理文件 - conda is not recognized as an internal or external command, operable program or batch file 'import' 不是内部或外部命令、可运行程序或批处理文件 - 'import' is not recognized as an internal or external command, operable program or batch file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM