当您没有管理员权限时,如何在 Windows 中安装 Python(任何版本)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33876657/
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
How to install Python (any version) in Windows when you've no admin priviledges?
提问by hernanemartinez
The "NO ADMIN PRIVILEGES" part is key. I need to install python but I do not have access to it in order to run the installation in a proper way. I'm also behind a firewall, so the "pip" option is quite limited.
“无管理员权限”部分是关键。我需要安装 python,但我无权访问它以便以正确的方式运行安装。我也在防火墙后面,所以“pip”选项非常有限。
Could you help me figure this out?
你能帮我解决这个问题吗?
Thank you so much in advance.
非常感谢你。
回答by Andy
From the Python website, download the MSI version of Python you wish to install.
从 Python网站下载您要安装的 Python 的 MSI 版本。
Then open your command prompt and use this command:
然后打开命令提示符并使用以下命令:
msiexec /a python-2.7.10.msi /qb TARGETDIR=C:\python27
Substitute python-2.7.10.msi
, if you downloaded Python 3 and adjust your target directory to where you want it to go.
替换python-2.7.10.msi
,如果您下载了 Python 3 并将您的目标目录调整到您想要的位置。
The /qb
flag will give you a small dialog progress bar.
该/qb
标志将为您提供一个小的对话框进度条。
回答by Ando G
回答by Sebastian Wozny
I suggest you use Anaconda.
我建议你使用 Anaconda。
Anaconda is a completely free Python distribution (including for commercial use and redistribution). It includes more than 300 of the most popular Python packages for science, math, engineering, and data analysis.
Anaconda 是一个完全免费的 Python 发行版(包括用于商业用途和再发行版)。它包括 300 多个最流行的 Python 包,用于科学、数学、工程和数据分析。
One great feature of Anaconda is that it installs to your home folder, to which you should have write access.
Anaconda 的一大特色是它会安装到您的主文件夹中,您应该具有写入权限。
It ships with a conda
script that let's you install packages too.
它附带了一个conda
脚本,让您也可以安装软件包。
Keep in mind that you will not be able to add it to the System PATH
, though you can try to add it to your user PATH
. If you can not add it to either, you will have to manually specify the full path to the python executable to run scripts from the command line.
请记住,您将无法将其添加到系统中PATH
,但您可以尝试将其添加到您的用户中PATH
。如果您无法将其添加到其中,则必须手动指定 python 可执行文件的完整路径才能从命令行运行脚本。
You can download Anaconda here.
您可以在此处下载 Anaconda 。
回答by skvp
I downloaded embeddable zip file from the site. Extracted it to the folder of my choice. Then added that folder in the windows path variable (using setx). It worked for me. Well this install only python and not the other packages like pip etc.
我从网站下载了可嵌入的 zip 文件。将其解压缩到我选择的文件夹中。然后在 windows 路径变量中添加该文件夹(使用 setx)。它对我有用。那么这个只安装 python 而不是 pip 等其他包。
Later I found better and simpler way with Python 3.7.0 version for windows.
后来我在 Windows 的 Python 3.7.0 版本中找到了更好更简单的方法。
- Download windows installer exe.
- Run the exe.
- Screen will be shown to chose the installation option.
- Uncheck "install for all users" option.
- Go for the custom installation.
- On next screen specify the directory path for which your user have full access on the computer.
- Uncheck "create shortcuts for installed application" option.
- Make sure "Add python to environment variable" option is Unchecked .
- complete the installation.
- Add the installation and Script folder path in Path using setx
- 下载 Windows 安装程序 exe。
- 运行exe。
- 将显示屏幕以选择安装选项。
- 取消选中“为所有用户安装”选项。
- 进行自定义安装。
- 在下一个屏幕上指定您的用户在计算机上具有完全访问权限的目录路径。
- 取消选中“为已安装的应用程序创建快捷方式”选项。
- 确保“将 python 添加到环境变量”选项为 Unchecked 。
- 完成安装。
- 使用setx在Path中添加安装和Script文件夹路径
This has installed all the default components of python
这已经安装了python的所有默认组件
回答by Lorinc Nyitrai
As mentioned earlier here, use Anaconda. The default installation process does not require Windows Admin privileges. It comes with nice package management (that might not work if you are sitting behind corporate firewalls). If you intend to do scientific computing, Anaconda is also the "strongly recommended"way to have Jupyter Notebookrunning locally.
如前所述,请使用Anaconda。默认安装过程不需要 Windows 管理员权限。它带有很好的包管理(如果你坐在公司防火墙后面,这可能不起作用)。如果您打算进行科学计算,Anaconda 也是在本地运行Jupyter Notebook的“强烈推荐”方式。
回答by VonC
With Windows 2010 edition May 2019, you won't have to execute a msi setup or download an Anaconda edition or go to the python website.
使用 2019 年 5 月的 Windows 2010 版本,您无需执行 msi 设置或下载 Anaconda 版本或访问 python 网站。
- Windows has a
python.exe
andpython3.exe
already pre-installed - those commands will get you directly to the Microsoft Store!
- Windows有一个
python.exe
和python3.exe
已预装 - 这些命令将使您直接进入 Microsoft Store!
Example: Python 3.7, which installs python
and puts python
on the path for the current user. So, no need for admin privileges.
示例:Python 3.7,它安装python
并放置python
当前用户的路径。所以,不需要管理员权限。
There is a discussion about this on the Talk Python To ME podcast #191 with Steve Dowerfrom Dec. 2018.
2018 年 12 月,Steve Dower在Talk Python To ME 播客 #191上对此进行了讨论。
See more at "Who put Python in the Windows 10 May 2019 Update?" from the same Steve Dower(also on Stack Overflow):
在“谁将 Python 放入 2019 年 5 月 10 日的 Windows 更新中?”中查看更多信息,来自同一个Steve Dower(也在Stack Overflow 上):
This version of Python is fully maintained by the community, installs easily on Windows 10, and automatically makes common commands such as
python
,pip
andidle
available (as well as equivalents with version numbers python3 and python3.7, for all the commands, just like on Linux).
这个版本的Python是由社会各界的充分维护,容易安装在Windows 10,并自动常用命令,例如
python
,pip
和idle
可用的(以及当量版本号python3和python3.7,对于所有的命令,就像在Linux上)。
回答by theB
Uncheck 'Install for all user' when the installation starts. Rest will be taken care by Python-3. I'm using Python-3.7.6 with this method.
安装开始时取消选中“为所有用户安装”。其余的将由 Python-3 处理。我正在通过这种方法使用 Python-3.7.6。
This installation method will automatically updates current user's path for Python. But the application name will be py
instead of python
. The user has to handle environment variables if he wants to use pip
or python
commands.
这种安装方法会自动更新当前用户的 Python 路径。但应用程序名称将py
代替python
. 如果用户要使用pip
或python
命令,则必须处理环境变量。