Python & Windows:python 启动器在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30794342/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 08:59:29  来源:igfitidea点击:

Python & Windows: Where is the python launcher?

python

提问by cqcn1991

I'm trying to use different versions of pythonon win7, and I was told that I can use the python laucher.

我正在尝试使用不同版本的pythonon win7,有人告诉我可以使用python laucher.

I find the docs for it: https://docs.python.org/3/using/windows.html#launcherBut I don't know where is it. Someone say its called py.exe, but there is no file with this name on my computer.

我找到了它的文档:https: //docs.python.org/3/using/windows.html#launcher但我不知道它在哪里。有人说它叫py.exe,但我的电脑上没有这个名字的文件。

I installed python 3.4.3with Anaconda, https://store.continuum.io/cshop/anaconda/, comes with Scipy

我装蟒蛇3.4.3Anacondahttps://store.continuum.io/cshop/anaconda/,自带Scipy

===========

============

UPDATE: Since there is no python launcerin Anacoda, how can I re-install it? Or if there is better way of using different version on Win7?

更新:由于没有python launcerin Anacoda,我该如何重新安装它?或者如果有更好的方法来使用不同的版本Win7

采纳答案by Alexander Huszagh

It should be in the root directory of Python 3.3 installs and higher. It is not available for Python2.

它应该在 Python 3.3 安装和更高版本的根目录中。它不适用于 Python2。

Go to C:\PythonXX\ and you should find py.exe for your version.

转到 C:\PythonXX\,您应该会找到适合您的版本的 py.exe。

In Command Prompt or your favorite shell (like Cygwin), run:

在命令提示符或您最喜欢的 shell(如 Cygwin)中,运行:

py -3.3 -m path/to/myscript.py

However, this only works if you have a 3.3 or higher installed.

但是,这仅在您安装了 3.3 或更高版本时才有效。

EDIT: Anaconda does not come with Python launcher. It is only available for an ActiveState, standard, or probably many other installs.

编辑:Anaconda 不附带 Python 启动器。它仅适用于 ActiveState、标准或可能许多其他安装。

EDIT2: Here are two brand-new, Python 3.4 installs of ActiveState Python and Anaconda Python, screenshotted. Notice how Anaconda Python does not include py.exe and a lot of other (non-essential) executables?

EDIT2:这里有两个全新的 Python 3.4 安装 ActiveState Python 和 Anaconda Python,截图。请注意 Anaconda Python 如何不包含 py.exe 和许多其他(非必要)可执行文件?

Anaconda InstallActiveState Install

蟒蛇安装活动状态安装

EDIT3: After some "difficult" testing, just set anaconda as your default install for Python3.4 and grab the py.exe from another install. That is all. So you can install Python3.4 from another source, uninstall it, and save the py.exe, make sure it is in the system path, and the python launcher is fully installed.

EDIT3:经过一些“困难”的测试后,只需将 anaconda 设置为 Python3.4 的默认安装,然后从另一个安装中获取 py.exe。就这些。所以你可以从其他源安装Python3.4,卸载它,并保存py.exe,确保它在系统路径中,并且python启动器已完全安装。

EDIT4: Actually there's also a standalone installer available here: https://bitbucket.org/vinay.sajip/pylauncher/downloads

EDIT4:实际上这里还有一个独立的安装程序:https://bitbucket.org/vinay.sajip/pylauncher/downloads

回答by Jakob Weisblat

It looks like the python executable is part of the condacommand if you're using Anaconda, according to their website. According to Alexander Huszagh (see his answer), the python launcherdoesn't come with Anaconda python.

conda根据他们的网站,如果您使用的是 Anaconda,看起来 python 可执行文件是命令的一部分。根据 Alexander Huszagh(见他的回答)的说法,蟒蛇启动器不附带 Anaconda python。

Here is a blog post that is perhaps relevant.

这是一篇可能相关的博客文章。

回答by user1040323

The experts gave a reply which seems relevant to one version of python but not the latest version. e.g. In my least favorite command line tool I entered:

专家给出的答复似乎与 python 的一个版本相关,但与最新版本无关。例如,在我最不喜欢的命令行工具中,我输入了:

C:\Program Files (x86)\Python36-32>dir py.exe /s

C:\Program Files (x86)\Python36-32>dir py.exe /s

It replied: File Not Found

它回答:找不到文件

回答by idbrii

If installing python from python.org's downloadsand you select "[x] install pylauncher [x] install for all users", py.exe is installed in C:\Windows\py.exe.

如果从python.org 的下载安装 python并选择“[x] install pylauncher [x] install for all users”,py.exe 安装在C:\Windows\py.exe.

I think if you don't install for all users, then it's in the python install root.

我想如果你不为所有用户安装,那么它就在 python 安装根目录中。

If you are able to run pyfrom cmd.exe, then you can find out where it is with where py.exe.

如果你能够运行pycmd.exe,那么你就可以找出它与where py.exe

回答by johnny

I first tried everything Alexander Huszagh has written. But none of it helped.

我首先尝试了 Alexander Huszagh 写的所有内容。但这都没有帮助。

It took me a really long time to find the Python Launcher. I had accidentally changed how to open .py-files. And once you change it, you can't do right mouse click "Edit with IDLE" anymore. I eventually found them in the C:\Windows\directory named py.exe.

我花了很长时间才找到 Python Launcher。我不小心改变了打开 .py 文件的方式。一旦你改变它,你就不能再用鼠标右键单击“用空闲编辑”了。我最终在C:\Windows\名为py.exe.