简体   繁体   中英

How to run python programs in Windows 7?

I downloaded this tool to migrate MySQL to PostgreSQL: https://github.com/philipsoutham/py-mysql2pgsql

Python interactive code works properly so the python path is set in the right way.

When I type "py-mysql2pgsql" being in the directory: C:\\Users\\me , the downloaded tool doesn't run but ask me to choose the program to open that file. The same situation when I'm in C:\\Users\\me\\py-mysql2pgsql

How can I run this tool properly?

Windows does not understand shebang lines in scripts (#!/usr/bin/env python) like Linux and Unix variants do. So Windows does not understand that this is a python script, you need to execute python yourself.

If python executable is in your path, you should be able to run:

python py-mysql2pgsql

If it is not in your path, you should be able to run:

path_to_python\python py-mysql2pgsql  (on my machine C:\Python27\python)

Note that this applies to any python script on Windows, not just this tool.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM