1

I installed python 3.4 and python 3.5 to C:\Python34 and C:\Python35 respectively. and I created two bat files refering to these executables namely python.bat and python35.bat and added them to my PATH. so that I can get

C:\>python -V 
Python 3.4.3

C:\>python35 -V
Python 3.5.1

C:\>pip

This works fine for me, except when I want to call PIP because it is actually inside the PythonXX\Scripts\ folder.

Is there an easy way to get away with calling pip and other scripts from cmd, without typing C:\>Python34\Scripts\pip or C:\>Python35\Scripts\pip each time?

(Note: pip is not the only file I want to run from Scripts folder. can I do the alias for the Scripts directory?)

8
  • couldn't you do the exact same thing than with the python executable? Commented Jan 19, 2016 at 12:50
  • 1
    Do something like set PATH=C:\Python35\Scripts;%PATH% in your bat file Commented Jan 19, 2016 at 12:51
  • @J.J.Hakala would that be a permanent change or for a single session only? (If it's permanent, you would be updating PATH for each time you load the bat file Commented Jan 19, 2016 at 12:53
  • @Zetys I was hoping to find a solution on the directory level, so that I dont need to rename all executables inside Scripts (pip and others) Commented Jan 19, 2016 at 13:00
  • 1
    FWIW, I have a pip2.7.exe in my c:\Python\Scripts and a pip3.5.exe in my c:\Python3\Scripts folder so I can be explicit about which one I want at the command line. Commented Jan 19, 2016 at 13:56

2 Answers 2

1

You can create symbolic links:

for %A in (c:\Python34\Scripts\*.exe) do mklink C:\Windows\System32\%~nA34.exe %A

Then call pip with pip34. Do the same thing with other python versions.

Sign up to request clarification or add additional context in comments.

2 Comments

is there a way to make an alias for the Scripts directory, so it works for all executables inside it?
not exactly what i was hoping for as it still alias the .exe files not the directory. (for example won`t work if .exe is in sub directory of Scripts). still useful though. thanks +1
0

You could set up some aliases

doskey pip34=C:\python34\scripts\pip
doskey pip35=C:\python35\scripts\pip

I don't have a windows shell to test this on, but from what I've read it "should" work.

1 Comment

There are multiple files inside scripts. so I am searching for a solution for the whole directory. I have updated the question to clarify this point

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.