Link to home
Start Free TrialLog in
Avatar of CAE5942
CAE5942

asked on

Path to Python

Hi everyone,

I'm trying to run python from the command line on Windows 7. To do this I did the following:

(1) Clicked on the start menu then right-clicked on Computer and chose "Properties"
(2) I then chose "Advanced System Settings" then clicked on the "Environment Variables" button
(3) I scrolled down under "System Variables" and clicked on "Path" and then clicked edit

The following was the path

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\

Since python is installed on the C drive I appended that extra bit to the path so it now looks like this:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Python27

Then in the command line I typed in:

python merge_csv.py

When I pressed enter, I got the following error:

'python' is not recognized as an internal or external command, operable program or batch file.

Can anyone tell me what the error means and how I can set the path correctly so it will run?

I'd really be grateful for any advice.
Avatar of Kim Ryan
Kim Ryan
Flag of Australia image

Try typing
python.exe merge_csv.py
Avatar of CAE5942
CAE5942

ASKER

Thanks for the reply. I tried typing that but I get the same error. Any other suggestions would be appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Kim Ryan
Kim Ryan
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of phoffric
phoffric

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CAE5942

ASKER

Thanks again for the replies. I added in the final semi-colon and then typed in python again in the command line and I got a similar result, ie.

C:\Python27>python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Does that mean it's running and knows which file to look at?
Yes, you can use your full command now.
Avatar of CAE5942

ASKER

That's great - thanks so much. Just one other question if that's ok: is there an easy way to create an alias of a .exe application file without using the command line? If not, would you be able to instruct me on how to create the alias? If I need to open up a new post please let me know.

Thanks again
Did you add the backslash as suggested?
When you type in path, what do you get?
Avatar of CAE5942

ASKER

No I didn't add the backslash. I found that I only needed to add the semi-colon at the end and then I was able to create the .exe file so it's all working as expected which is great. I just need to find out how to make an alias of the .exe file.