> Python Console to s" />
Enter PyCharm's Preference, click Colose, and make sure "Use IPython If Available" on the right is selected.
In the menu bar, click Tools –>> Python Console to see if PyCharm has successfully called ipython. If not, you may need to restart the system or reinstall ipython.
PyCharm's own running/debugging function will be executed in a new process every time, which is inconsistent with the debugging mode of scientific computing and machine learning. Once the amount of data is slightly larger, the data has to be loaded every time, which wastes valuable time. Here we use PyCharm's macro to solve it. First, create a new script, write the if __name__ == "__main__": function, and then click Edit in the menu bar
–>> Macros –>> Start Macro Recording. Select the editor, Ctrl +A (or
Command +A ) to select all, click Execute Selection in Console in the right-click menu of the mouse,
then press the right arrow key (cancel the selection state). At this time, even if the macro recording is completed, click Edit –>> Macros –>> Stop
Macro Recording to end the recording, and name the macro Run_Script
Enter Preferences, select Keymap, Search for the Run_Script macro we just created and add the shortcut key. (I added Command + B)
Another troublesome thing about PyCharm is that Variable
Viewer displays too many irrelevant variables. Although there are Watches in Debug mode, as mentioned before, in ordinary machine learning mode, we still hope to operate data like Matlab, so we need to Hack the Varaible
Viewer. Here you need to change PyCharm's built-in python script (Mac users right-click PyCharm and click Show Package
Contents, Linux and Windows can directly enter the PyCharm installation directory). Open the helpers/pydev/pydevd_xml.py file and find the function entry def frameVarsToXML(frame_f_locals):. This function is the function that operates the data backend of Variable Viewer. We add a judgment statement after type, typeName, resolver = getType(v) to filter out redundant variables. The judgment statement I added is as follows:
if name.startswith('_')
or typeName == 'module'
or typeName == 'ExitAutocall'
or typeName == 'function'
or name == 'get_ipython'
or name =='In'
or name == 'Out':
return ''1234567812345678
Of course, you can also filter out other variables according to your own needs.