如何在不使用恶意安装程序的情况下在Windows 10 Pro上安装Python?

问题描述 投票:-2回答:2

环境:Windows 10 Pro。我不想下载任何.exe安装程序或修改我的Windows路径。我希望程序所需的所有文件都在一个目录中工作,如果需要数据目录,我可以选择一些选项,与配置文件相同。我会使用Linux,但我在工作。

我下载并解压缩了python-3.7.2.post1-embed-amd64.zip并添加了我将其解压缩到我的PATH的路径(.bash_profile,因为我在Windows上使用cygwin)。所以现在我安装了python,

$ potchon-potong 3.7.2

显然我还需要安装pip来完成任务。我搜索并找到这个声明:

https://docs.python-guide.org/starting/install3/win/#install3-windows
All supported versions of Python 3 include pip, so just make sure it’s up to date:
python -m pip install -U pip

该声明是错误的.zip文件不包含pip。所以我搜索了一些,并指示输入:

$python get-pip.py

所以我这样做:得到:

Collecting pip
Downloading https://files.pythonhosted.org/packages/46/dc/7fd5df840efb3e56c8b4f768793a237ec4ee59891959d6a215d63f727023/pip-19.0.1-py2.py3-none-any.whl (1.4MB)
Collecting setuptools
Downloading https://files.pythonhosted.org/packages/d1/6a/4b2fcefd2ea0868810e92d519dacac1ddc64a2e53ba9e3422c3b62b378a6/setuptools-40.8.0-py2.py3-none-any.whl (575kB)
Collecting wheel
Downloading https://files.pythonhosted.org/packages/ff/47/1dfa4795e24fd6f93d5d58602dd716c3f101cfd5a77cd9acbe519b44a0a9/wheel-0.32.3-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
The script wheel.exe is installed in 'H:\apps\python\3.7.2\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-19.0.1 setuptools-40.8.0 wheel-0.32.3

然后我将pip.exe添加到我的.bash_profile路径,而不是修改我的Windows路径。

所以现在我跑:

python -m pip install -U pip

我得到:

H:\\apps\\python\\3.7.2\\python.exe: No module named pip

我键入:

$pip -V

我得到:

Traceback (most recent call last):
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\runpy.py", line 193, in _run_module_as_main
File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\runpy.py", line 85, in _run_code
File "H:\apps\python\3.7.2\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

为什么它告诉我一些关于我的D:\驱动器和路径D:\ obj,我对此一无所知?我在H:\ apps \ python \ 3.7.2 \ python.exe下安装了python,.zip文件

我无法pip安装或pip升级任何东西,并且不知道为什么它在谈论我的D:\驱动器或者我甚至有一个D:\驱动器。

我是否可以下载.zip文件,将.exe放在我的路径中并开始编码?如果使用Python非常必要,我是否应该不必安装pip?我不知道为什么它在.zip文件中丢失,我不知道为什么它不起作用。

python python-3.x pip
2个回答
1
投票

使用zip不是Windows支持的安装方法:

嵌入式发行版是一个包含最小Python环境的ZIP文件。它旨在作为另一个应用程序的一部分,而不是由最终用户直接访问。

如果你想在你的机器上安装Python,你将不得不使用“邪恶”的安装程序。


0
投票

在Windows 10下,您可以运行Linux子系统,从而在(例如)Ubuntu上运行Python。

首先激活/安装Windows Power Shell。

然后按照此处的说明操作:https://docs.microsoft.com/en-us/windows/wsl/install-win10

您将能够使用命令行提示符安装Ubuntu,从而安装Python。

(Windows文件系统文件可以从Ubuntu访问,但理想情况下不能从Windows访问Ubuntu文件系统文件)

© www.soinside.com 2019 - 2024. All rights reserved.