59

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.

Could you help me figure this out?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
hernanemartinez
  • 617
  • 1
  • 5
  • 10
  • http://stackoverflow.com/questions/2678702/install-python-2-6-without-using-installer-on-win32 maybe? – cdvv7788 Nov 23 '15 at 17:15
  • The latest Windows 10 May 2019 edition (4 years later) considerably simplify the installation process. See [my answer below](https://stackoverflow.com/a/56500630/6309) – VonC Jun 07 '19 at 20:05

8 Answers8

69

From the Python website, download the MSI version of Python you wish to install.

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 TARGETDIR to where you want it to go.

The /qb flag will give you a small dialog progress bar.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Andy
  • 49,085
  • 60
  • 166
  • 233
  • 1
    Can you explain how this works? is it to do with /a? – philcolbourn Jun 01 '17 at 03:18
  • 2
    [This answer](https://stackoverflow.com/a/2684631/154770) explains a bit further. Also see the official docs on [Administrative Installation](https://msdn.microsoft.com/en-us/library/windows/desktop/aa367541(v=vs.85).aspx). – Todd Owen Jun 28 '17 at 13:20
  • 8
    The Python 3 installer is not a MSI file. – Herohtar Mar 27 '19 at 17:38
  • 3
    I then had to run `python -m ensurepip` to install `pip` into the `Scripts` directory. – Peter Wood May 13 '19 at 07:32
  • 2
    I could not find an msi package for python 3.8 https://www.python.org/downloads/release/python-380/ – jerik Oct 21 '19 at 09:29
  • 1
    @jerik You can install from the `.exe` since python 3.7 (I think). Look at the answers below. – Holt Jan 13 '20 at 09:47
37

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.

Later I found better and simpler way with Python 3.7.0 version for windows.

  1. Download windows installer exe.
  2. Run the exe.
  3. Screen will be shown to chose the installation option.
  4. Uncheck "install for all users" option.
  5. Go for the custom installation.
  6. On next screen specify the directory path for which your user have full access on the computer.
  7. Uncheck "create shortcuts for installed application" option.
  8. Make sure "Add python to environment variable" option is Unchecked .
  9. complete the installation.
  10. Add the installation and Script folder path in PATH using setx

This has installed all the default components of python

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
skvp
  • 1,940
  • 1
  • 20
  • 25
  • 7
    uncheck "install for all users" – Jason Nov 09 '18 at 16:21
  • Please explain setx in step 10. – Foo Bar Mar 09 '21 at 18:21
  • 1
    If python is installed at location c:\programs\Python, then path of the script folder should be c:\programs\Python\Scripts. Add these to folders in the path using setx as setx PATH "%PATH%;C:\programs\Python\;C:\programs\Python\Scripts\" – skvp Mar 10 '21 at 10:27
14

As the comment states: "uncheck '[Install launcher] for all users'"..

enter image description here

Adam Cox
  • 3,341
  • 1
  • 36
  • 46
11

I suggest you use Anaconda (open source edition).

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.

One great feature of Anaconda is that it installs to your home folder, to which you should have write access.

It ships with a conda script that let's you install packages too.

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.

Foo Bar
  • 328
  • 3
  • 20
Sebastian Wozny
  • 16,943
  • 7
  • 52
  • 69
  • 6
    Even if access via the GUI is blocked, you can usually edit the *user* environment variables (including `PATH`) by running: `rundll32 sysdm.cpl,EditEnvironmentVariables` – Todd Owen Jun 28 '17 at 13:25
8

I would suggest you try using Anaconda. It can be installed to a local user folder without requiring admin permissions.

With this, you also get a quite nice package management conda.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Ando G
  • 121
  • 4
  • 12
    How does this solve the problem of having no admin privileges? I'm not sure your answer solves the OP's problem. – Richard Erickson Nov 23 '15 at 17:25
  • 1
    In our company environment this installer is working well, since it is only extracting the files in a user-writeable location and setting up the environment correspondingly. – Ando G Nov 23 '15 at 17:39
  • 4
    Then why don't you expand your answer to include that information? :) – Richard Erickson Nov 23 '15 at 17:48
  • Yes it does, because you can install it anywhere you want, e.g. into you home directory, so no admin priviliges required – MaxNoe Nov 23 '15 at 18:13
  • 1
    1) short question, short answer 2) I'm no anaconda-evangelist and don't know about the background details so much I would provide better info than the homepage does 3) some background info is nice, especially on controversial topics, but this was quite straight for me. – Ando G Nov 23 '15 at 18:24
3

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.

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.

theB
  • 2,048
  • 2
  • 20
  • 29
  • 1
    If you check the box to update environment variables, you will have python and pip in your path. – Holt Jan 13 '20 at 09:47
  • @Holt can you provide the example what kind of path needed for pip an python in environment variables ? – sathya Jan 14 '20 at 08:04
  • @sathya With python 3.8.1, you only need `Python38` and `Python38\Scripts` where `Python38` is the installation folder of python. With the 3.8.1 `.exe` installer, I did not have to update the path manually, the installer did it for me (I had to check the relevant box). – Holt Jan 14 '20 at 08:38
2

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).

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Lorinc Nyitrai
  • 968
  • 1
  • 10
  • 27
1

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.

  • Windows has a python.exe and python3.exe already pre-installed
  • those commands will get you directly to the Microsoft Store!

Example: Python 3.9, which installs python and puts python on the path for the current user. So, no need for admin privileges.

There is a discussion about this on the Talk Python To ME podcast #191 with Steve Dower from Dec. 2018.

See more at "Who put Python in the Windows 10 May 2019 Update?" from the same Steve Dower (also on 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 and idle available (as well as equivalents with version numbers python3 and python3.7, for all the commands, just like on Linux).

https://devblogs.microsoft.com/python/wp-content/uploads/sites/12/2019/05/Python_After-1024x449.png

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I wanted to comment that I'd rather not go the the MS store. But then I realized how high your reputation is and if I might change my attitute because of this. – bomben Jan 31 '22 at 08:22
  • 1
    @bomben Thank you. I just realized the Python 3.7 link was obsolete. I have updated and restored the link. – VonC Jan 31 '22 at 08:29