如何通过 py 启动器 运行 Python 安装脚本?
How to run Python installed scripts via py launcher?
使用 Python Launcher 效果很好:py.exe -3.5 helloworld.py
这也适用于 运行 相应的 pip
(也不在 PATH
中):py.exe -3.5 -m pip
.
有没有办法让它也适用于已安装的脚本?
背景:这允许并行安装多个 Python 版本,即使它们不在 PATH
中也可以轻松使用它们。但是例如我不能 运行 pyinstaller.
C:\Python35\Scripts\pyinstaller.exe
有效。
py -3.5 C:\Python35\Scripts\pyinstaller-script.py
可以,但仍然需要我知道安装路径。
py -3.5 -m pyinstaller
不起作用。它只是打印 C:\Python35\python.exe: No module named pyinstaller
.
py -3.5 -m pyinstaller-script
不起作用。它只是打印 C:\Python35\python.exe: No module named pyinstaller-script
.
有办法做到这一点吗?
我认为模块名称不正确。这对我有用:
py -3.5 -m PyInstaller
您可以通过pip查看模块名称。例如
$ py -m pip list
在我的工作站上显示:
Package Version
--------------- --------
altgraph 0.16.1
cycler 0.10.0
future 0.16.0
kiwisolver 1.0.1
macholib 1.10
matplotlib 2.2.2
numpy 1.15.0
pefile 2018.8.8
pip 10.0.1
PyInstaller 3.3.1
pyparsing 2.2.0
pypiwin32 223
python-dateutil 2.7.3
pytz 2018.5
pywin32 223
setuptools 39.0.1
six 1.11.0
注意列表中 PyInstaller 的大小写。
使用 Python Launcher 效果很好:py.exe -3.5 helloworld.py
这也适用于 运行 相应的 pip
(也不在 PATH
中):py.exe -3.5 -m pip
.
有没有办法让它也适用于已安装的脚本?
背景:这允许并行安装多个 Python 版本,即使它们不在 PATH
中也可以轻松使用它们。但是例如我不能 运行 pyinstaller.
C:\Python35\Scripts\pyinstaller.exe
有效。py -3.5 C:\Python35\Scripts\pyinstaller-script.py
可以,但仍然需要我知道安装路径。py -3.5 -m pyinstaller
不起作用。它只是打印C:\Python35\python.exe: No module named pyinstaller
.py -3.5 -m pyinstaller-script
不起作用。它只是打印C:\Python35\python.exe: No module named pyinstaller-script
.
有办法做到这一点吗?
我认为模块名称不正确。这对我有用:
py -3.5 -m PyInstaller
您可以通过pip查看模块名称。例如
$ py -m pip list
在我的工作站上显示:
Package Version
--------------- --------
altgraph 0.16.1
cycler 0.10.0
future 0.16.0
kiwisolver 1.0.1
macholib 1.10
matplotlib 2.2.2
numpy 1.15.0
pefile 2018.8.8
pip 10.0.1
PyInstaller 3.3.1
pyparsing 2.2.0
pypiwin32 223
python-dateutil 2.7.3
pytz 2018.5
pywin32 223
setuptools 39.0.1
six 1.11.0
注意列表中 PyInstaller 的大小写。