Using Pycharm to implement Python remote debugging __python

Source: Internet
Author: User
Tags python script in python

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:



 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.