I have installed python 32 package to the
C:\\python32
I have also set the paths:
PYTHONPATH | C:\\Python32\
You can set up 2to3.py to run as a command when you type 2to3 by creating a batch file in the same directory as your python.exe file (assuming that directory is already on your windows path - it doesn't have to be this directory it just is a convenient, relatively logical spot).
Lets assume you have python installed in C:\Python33
. If you aren't sure where your python installation is, you can find out where Windows thinks it is by typing where python
from the command line.
You should have python.exe
in C:\Python33
and 2to3.py
in C:\Python33\Tools\Scripts
.
Create a batch file called 2to3.bat
in C:\Python33\Scripts
and put this line in the batch file
@python "%~dp0\..\Tools\Scripts\2to3.py" %*
The %~dp0
is the location of the batch file, in this case c:\Python33\Scripts
and the %*
passes all arguments from the command line to the 2to3.py
script. After you've saved the .bat file, you should be able to type 2to3
from the command line and see
At least one file or directory argument required.
Use --help to show usage.
I have found this technique useful when installing from setup.py, because sometimes the setup script expects 2to3 to be available as a command.