0

This likely sounds like a stupid question, but I can't seem to access python from cmd unless the working directory is on the c: drive. Ultimately, I want to run a script on a network folder (z:), but python won't even execute from my secondary internal drive (d:)

example cmd window text:

Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\usrname>python
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

C:\Users\usrname>z:

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

Z:\>d:

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

D:\>

calling other programs like pip works just fine, as well as many of the commands from cygwin (added cygwin/bin to %path%) Python however remains obstinate. Can someone explain to me why this may be happening?

edit: here's my %path%

C:\Users\usrname\Downloads>echo %PATH%
C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\cygwin64\bin;C;\Python27\WinPython-32bit-2.7.10.2\python-2.7.10;C:\Python27;C:\Python27\WinPython-32bit-2.7.10.2\python-2.7.10\Scripts;C:\Program Files (x86)\CMake\bin
1

If you litereally added cygwin/bin to your path, then that's why it doesn't work.

That's a relative path, which will only work from the root of the drive on which that folder is present, i.e. C: on C:\cygwin\bin.

Otherwise, when on D:, Windows will search D:\cygwin\bin and happily report it's not there. Same goes for C:\Users\usrname where you claim to be, then C:\Users\usrname\cygwin/bin will be searched.

So I assume you added /cygwin/bin to your path, with a (back)slash in front. This will make it work, regardless of your current directory, as long as you're on the C: drive.

You need to add the absolute path to %path%, including the drive letter.

According to your edit, you have a typo in your python path:

C;\Python27\WinPython-32bit-2.7.10.2\python-2.7.10

The semicolon should be a colon. Please note that this does validate the above statements: this path entry means you have two path entries: C and \Python27\WinPython-32bit-2.7.10.2\python-2.7.10, the latter causing it to work from the C: drive only, as that's the only drive containing that directory.

  • nope, I include c: in all my path entries... – Aaron Sep 24 '15 at 11:00
  • Well show in your question what %path% looks like then, or how exactly you set it. I've just tested this, and without the drive letter it shows the behavior you describe. – CodeCaster Sep 24 '15 at 11:01
  • also python is a separate entry from cygwin, as well as a separate env variable %PYTHONPATH%. – Aaron Sep 24 '15 at 11:01
  • The command-line interpreter only looks in %path%, not %PYTHONPATH%. – CodeCaster Sep 24 '15 at 11:01
  • 1
    ............ I found it -_- thanks ............ ;C;\Python27\WinPython-32bit-2.7.10.2\python-2.7.10 – Aaron Sep 24 '15 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.