Python Remote Debugging
A Introduced
Python remote debugging, that is, running Python code on a remote machine and debugging locally.
Need environment: Python http://www.python.org/getit/
Debugging environment: Pycharm http://www.jetbrains.com/pycharm/
Dependencies required: Remote and local need to install Pycharm-debug.egg in Python path
Note: Installation of egg package requires the first installation Setuptools
Two Install Setuptools
url:https://pypi.python.org/pypi/setuptools/
Use the ez_setup.py script installation directly in the WINDOWS/LINUX environment:
1. Download script:
https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
The script will automatically download the setuptools-1.1.6.tar.gz
2. Run script: Python ez_setup.py can complete setuptools installation
(Note: If the machine is not connected to the server, you can copy the ez_setup.py and setuptools-1.1.6.tar.gz package to the machine, put it in the same directory, and then run the ez_setup.py)
Three Install Pycharm-debug.egg
The Pycharm-debug.egg can be found under the Pycharm installation directory, and the Easy_intall command can be found under the Python installation path (Setuptools installed) and executed:
Easy_install.exe Pycharm-debug.egg can complete the installation.
Four Remote debugging
1. Open Pvcharm, configure remote debugging:
(a). Open edit Confiurations
(b). Add Python Remote Debug
(c). Configure the local IP, port number, such as: 192.168.112.6, this IP for you to debug the machine's IP, remote machines need to connect this IP.
(d) Write the Python code that will be debugged locally on the remote machine, plus at the entrance:
Import PYDEVD
Pydevd.settrace (' 192.168.112.6 ', port=51234, Stdouttoserver=true, Stderrtoserver=true)
The configured IP, port is the IP and port number configured on the local pvcharm, that is, the IP of the Pvcharm machine and the port number on which to turn on debugging.
2. Start debugging
A to start debugging services on the local pvcharm, such as
The following illustration shows:
b Run the Python script on the remote machine:
c) At this time can be clicked "Download" Download Source:
d) Start Debugging: