Windows doesn't seem to keep my system environment variables

jazzvibes

New member
Local time
12:13 PM
Messages
2
Hi all,

As far as I can tell, my problem seems to be quite simple. The solution, however, may not be quite as simple.

The application I am trying to make work is python 3. I also have python 2 installed, but that works fine.

The problem is at the command prompt I would like to be able to type
Code:
python3
and have it launch the python 3 shell. Currently, all I get is
Code:
'python3' is not recognized as an internal or external command,
operable program or batch file.
If I type
Code:
C:\Users\Jazzvibes>python
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
it already launches python 2 (which is correct).

I have already tried to put python3 as a system and user environment variable, in AFAIK the same way as python is set up. I changed this at the system properties window and then going to environment variables on the "Advanced" tab.

if I type
Code:
set
at the command prompt, I believe it should confirm this (please correct me if i'm mistaken)
Code:
python=C:\Python26\python.exe
python3=C:\Python31\python.exe
So, have I done something wrong, or left a step out? Please let me know if you need more info.

I should point out that typing a hard link to python3 using the address above does work, but I would like the shortcut for convenience (and to work out why it doesn't work in the first place)

My system for the record is Win7 64bit. Although both python installations are 32 bit versions (although i'm fairly sure that is trivial)

Regards,
Jazzvibes
 
Last edited:

My Computer

Computer Manufacturer/Model Number
Dell XPS M1210
OS
Windows 7 64bit
CPU
T7200
Memory
2GB
Graphics Card(s)
NVidia 7400 Go
I have never done anything like you are attempting to do. (Setting up an alias for an executable)

I would tackle the problem by creating .cmd or .bat files that are in the path that then calls the proper executable and passes along all parameters.

For example, your batch file for python 3 would be called python3.bat (captain obvious to the rescue ;) ) and you would include the following code:

Code:
C:\Python31\python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9

I'm not sure you need to include all of those command line parameter pass-throughs but it can't hurt.
 

My Computer

Computer Manufacturer/Model Number
Home Build
OS
Windows 7 Ultimate x64
CPU
Core i5 760
Motherboard
Biostar T5XE (P55)
Memory
2x2GB Mushkin PC3-10666
Graphics Card(s)
GeForce GTX 460
Internet Speed
FiOS 25Gbps down & up
Add C:\Python31 to the end of the existing path environment variable. You do this by adding a ; (semi colon) then the path to C:\Python31. That will make it accessible from a Command Prompt.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
In order to access your environment variable from the command line you need to bracket it with % like this: %python3%. In order to use the environment variable in a batch file you need to bracket it with %% like this: %%python3%%
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Home Built desktop, Dell G15 5511 Gaming laptop,MS Surface Pro 7 tablet
OS
W10 Pro desktop, W11 laptop, W11 Pro tablet (all 64-bit)
CPU
3.7Ghz 8700K i7, i7-11800H, i7-1065G7
Motherboard
ASUS TUF Z370-Pro Gaming in desktop
Memory
16G desktop, 16G laptop, 4G tablet
Graphics Card(s)
AMD Radeon RX580, RTX 3060, Intel Iris Plus
Sound Card
High Definition Audio (Built-in to mobo)
Monitor(s) Displays
Samsung U32J59 32" (2x), 15.6", 12"
Screen Resolution
3840x2160, 3840x2160, 1920x1080, 2160x1440
Hard Drives
500G SSD for OS; 2T, 10T & 15T HDDs for Data on Desktop, 1TB SSD laptop, 128G SSD tablet.
PSU
Corsair CX 750M
Case
Antec 100
Cooling
CM 212+
Keyboard
IBM Model M - used continuously since 1986
Mouse
Microsoft Pro IntelliMouse
Internet Speed
400M down 8M up
Antivirus
Windows Defender
Browser
FireFox
Other Info
Built my first computer (8Mhz 8088cpu, 640K RAM, 20MB HDD, 2 360K floppy drives) in 1985 and have been building them for myself, relatives and friends ever since.
Woah thanks! Some good working solutions.
ZTruker has suggested the one that is most like the original though. I looked in the path variable to find C:\Python26, and added C:\Python31 and now it works exactly as expected.

the batch file method and the %python3% method both worked well too. :D
 

My Computer

Computer Manufacturer/Model Number
Dell XPS M1210
OS
Windows 7 64bit
CPU
T7200
Memory
2GB
Graphics Card(s)
NVidia 7400 Go
Back
Top