First, you will need to download an IDE such as VS Code, IntelliJ PyCharm or Idea, etc. If you are given the option to add to path, do it. Restarting the terminal may be needed for the change to propagate. For VS Code, install the suggested plug-ins such as PyLance.
Alternatively, just open your IDE and open the project folder through the GUI. The below is more convenient once you set it up and learn it.
cd
, drag and drop the folder in which the project is (tested with Windows Terminal)._your_editor_ .
, i.e. code .
(run program aliased as code in the folder ".", which is the current directory).code .
) and IntelliJ (pycharm .
) editors. See the Using an IDE section for features you might want to use.vi file.py
. Note that you can press tab to get help from autocomplete instead of typing out file names, it'll look through the possibilities and give as many characters as unambiguous.Alt-Tab
or Cmd-Tab
to switch between windows.I use VS Code (on Windows, but shortcuts should be the same), so specific directions & shortcuts are for that IDE, but most IDE's should have the same features, so you can look up how to do it in yours. You should try these out in the python basics or the tutorial project; this can save you a lot of time in the future projects.
These are in rough order of usefulness.
mouse hover
to see what a variable is, Ctrl- mouse hover
to see stringdoc or definition, Ctrl- mouse click
or f12
to navigate to definition. Especially helpful for functions, although the IDE may not always figure out the definitions, for instance when PyLance in VS Code can't figure out what class's method is getting called.Ctrl-Shift-F
. If you want to find what function foo
does, search for def foo
Ctrl-`
(the symbol to the left of 1).python -V
(note the capital V) to check that the Python version is 3.6.f5
. Select Python, make sure your Python 3.6 interpreter is in use, choose "current python file".Shift-Option-F
, Windows Shift-Alt-F
, Linux Ctrl-Shift-I
.Ctrl-P
.Ctrl-Shift-P
.Alt-Tab
on Windows and Linux or Cmd-Tab
on MacOS. Pressing tab more than once chooses a less recent window.Ctrl-T
to open new tab, Ctrl-Shift-T
to re-open the most recently closed tab (repeatable), Ctrl-W
to close the current tab, Ctrl-Tab
and Ctrl-Shift-Tab
to cycle between tabs (Firefox and Chrome are different with this last one).This is not related to course content or the workflow at all.
The OS has many executable files, and it needs the path to the executable to run it. For instance, clicking an icon in program list or taskbar/ dock is just a shortcut -- mapping from program name to the location of the file to execute. From the terminal, we can simply navigate into the folder of the executable and run the file, or give the absolute path to the file.
In the terminal, a command consists of first the program, then its options and arguments. If the program part doesn't have any "/" in it, it is recognized as an attempt to use the Path environment variable.
Path is conceptually a collection of shortcuts for commands. The OS looks for the first word as an executable in the folders given in the Path variable. We simply need to add the folder containing the appropriate program to Path if we want to call if from anywhere.
Anaconda effectively changes what python
corresponds to, pointing it to a different Python interpreter. Furthermore, it keeps that Python interpreter and its installed libraries separate from everything else, all without breaking the Path variable.
Written by: Evgeny Pobachienko