INSTALLATION & ENVIRONMENT SETUP (Windows, Linux, macOS)

Welcome back to Digital Academy, the Complete Python Development Course for Beginners.

In the previous video, you may have discovered what is Python: its features and some of its benefits, but also what is it used for, as well as what could be you career opportunities. Now, let’s dig in, install Python on your PC or Mac, then set up your environment so you can start learning and, more importantly, practicing.


Getting Python


Python is a free, open-source software that works on: Windows, Linux, Mac – and various other platforms.

Many operating systems, such as macOS and Linux, come with Python pre-installed. The version that comes with your operating system is almost always out-of-date, and may not even be a full Python installation. Therefor, It is essential that you have the most recent version of Python, so that you can follow along successfully, with the examples in this entire Python Development Course for Beginners.

But you are confused, since there are multiple versions of Python, and you do not even know which one to choose? Don’t worry, this video will hep you download and install Python, plus your new favourite editor.


Choosing a Python Version


There are two major versions of Python available: Python 2, also known as legacy Python, and Python 3!

It can be confusing for both new and seasoned programmers on deciding between Python 2 or 3. Fortunately, there are few syntactical differences, between the two of them. And, you can run even both versions, on your computer!

To check out whether Python is already installed on your machine, or your current version, open the terminal and run the following command:

python -V

If you see a response from Python, some information will appear on the screen, including: the word Python, followed by the version number, and the build information. Python is already installed, but may need un update!

Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> 

Which version is right for you?

Well, that’s up to you. Honestly, there are few differences between the two that will affect you at this early stage, so either choice will suffice. Plus, once you have learned one, it is not too difficult to learn the other.

In general, if you are just starting to learn Python, go with Python 3. It is a well-known better version as there are added features, along with plenty of bug fixes and a few refinements. However, Python 2 has much more support from third-party libraries. If you know you will need to use a library that has not been ported to version 3 yet, then it may be best to start with Python 2.

Nonetheless, Python 2 was released in the year 2000, and has since reached its ends-of-life on January 1, 2020. So, this entire course will focus on Python 3 only, which is currently in active development, in terms of gaining new features and functionality. That said, most of the examples will work fine with either version, since many of the features and the updates added to Python 3, were also added to Python 2.

Python 2 vs Python 3

How Do I Get Python?


Installing Python on Windows is a slightly longer process, when compared to installing Python on Linux. In Linux, it is as easy as running a command, and having it set up. With Windows or macOS, it takes a slightly different route!

To get started working with Python 3, you will need to have access to the Python Interpreter. Fortunately, there are several common ways, to accomplish this.

Regardless of your Operating System, Python can be obtained from the Python Software Foundation website itself – at python.org. Typically, that involves downloading the appropriate installer, for your operating system – Windows, Linux or macOS. Run it on your machine, then follow the instructions, so that you can properly install Python, and setup your environment. On Windows, you need to be sure to check the box that says “Add Python 3 to PATH”, so you can ensure that the interpreter will be placed in your execution path. Otherwise, you won’t be able to call Python!

But there are also multiple alternatives, depending on your platform:

  • On Linux, it provides a package manager that can be run to install Python.
  • On macOS, the best way to install Python 3 involves installing a package manager, called Homebrew.
  • Another option, if you are using Windows 10, is to use a feature called the Windows Subsystem for Linux (WSL), which allows you to run a Linux environment, directly in Windows, and without the overhead of a virtual machine.
  • On mobile operating systems, like Android and iOS, you can install apps that provide a Python programming environment, like Pythonista. This can be a great way to practice your coding skills, on the go.

Alternatively, there are also several websites that allow you to access a Python Interpreter Online, without installing anything on your computer, at all. If you feel concerned about downloading Python onto your computer, or you just cannot do that for some reasons, then you are in luck! The Python Software Foundation offers an interactive Python Shell, from PythonAnywhere. You do not need to install it to use it, and it can be accessed on http://python.org/shell. Many other alternatives are: PythonAnywhere, Repl.it, and so on.


Python Interactive Shell


Now that you have downloaded and installed Python, Let’s do a quick sanity check, to ensure everything is correctly set up, ready to watch the next video, and practice for hours!

Open the Python’s built-in Integrated Development and Learning Environment (IDLE), also known as the Interactive Python Shell. It is one of the mediums of communication, between the Python Interpreter, and You.

To do so, just open your terminal and type python, if you only have one version of Python installed. If multiple versions of Python already exist, you may have to manually run python3.

The Interactive Python Shell should open, and your command prompt, or terminal window, should look similar to this:

Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> 

You may not get the first couple of lines exactly as shown above, since everyone has different computers, versions, and even builds. As you have probably guessed, the interpreter tells us the Python version, date of build, the compiler used to build it, the computer’s architecture, and the operating system. This information is important for debugging. And it is very useful, for checking Python’s version.

The most important thing, that you will need to remember, are those three greater-than signs (>>>). They symbolize a prompt, that asks you for some input. Since this prompt is shown in a few examples, you will need to remember that it is not some special keyword, or thing you would need to type on a daily basis.

While you are still in the Interactive Python Shell, you might as well run your first line of code:

>>> print("Learning Python with Digital Academy is fun!")

Once you typed Enter, your code is being executed and interpreted, then you should see “Learning Python with Digital Academy is fun!”:

>>> print("Learning Python with Digital Academy is fun!")
Learning Python with Digital Academy is fun!

As you can see, a newline without the prompt, is Output. Another important thing to know, is that the prompt changes to three periods (…), if you enter a command with indentations, since the Python interpreter is expecting more input. Overall, you will need to be careful not to mistake the prompt, for actual Python code.

>>> if True:
...     print("Like, Comment & Share!")
...
Like, Comment & Share!

And that’s it! Congratulations! You have just written your first Python program! Each time you entered a line, Python immediately executed the statement, displaying the value between the quotes.

Once you are done, you can type exit() or quit(), to leave the Interactive Python Shell. You can even use the keyboard shortcuts keys: Ctrl+D, then press Enter.

>>> exit()

Python Script


You will eventually find it tedious to retype programs into your shell, line by line. Like other interpreted programming languages, you can store and execute Python code, from a file. There are two main types of Python files: plain text, and bytecode files. Plain text files are simple files that you can create and edit, with just a simple plain text editor. For instance: Notepad, Notepad++, or Python’s Integrated Development Environment. The other type of file, bytecode files, are compiled Python files. Don’t worry about this type of file for now, which will be discussed later on in this course.

A Python script file name ends with the extension .py, and will be executable when you execute the script by itself, on most operating systems. Create a file called “hello.py” and write the following code into it.

#!/usr/bin/python3
print("Hello world, from a Python script!")
input("Press enter to continue... ")

Now, run the script by either clicking on it, or by running it from your system’s shell. The script should print “Hello world, from a Python script” and “Press enter to continue…”, then it should pause, until you press the Enter key! Congratulations, you got your first Python Script to work.

Hello world, from a Python script!
Press enter to continue...

Integrated Development Environment (IDE)


IDLE, or Integrated Development and Learning Environment, is the default IDE, that comes when you install Python. Writing Python code using IDLE or even the Python Shell is great for simple things, but those tools quickly turn larger programming projects into frustrating pits of despair. Using an IDE, or even just a good dedicated code editor, makes coding fun—but which one is best for you?

An IDE (or Integrated Development Environment) is a program dedicated to software development. As the name implies, IDEs integrate several tools, specifically designed for software development, which usually include:

  • An editor designed to handle code (syntax highlighting, indentation and auto-completion)
  • Build, execution, and debugging tools
  • Some form of source control

Most IDEs support many different programming languages, and contain many more features. They can, therefore, be very large and take time to download, and install. You may also need advanced knowledge to use them properly!

In contrast, a dedicated code editor can be as simple as a text editor, with syntax highlighting, but also code formatting capabilities. Most good code editors can execute code and control a debugger. The very best ones interact with source control systems as well. Compared to an IDE, a good dedicated code editor is usually smaller and quicker, but it’s often less feature rich.

So what things do we really need in a coding environment? Feature lists vary from app to app, but there are a core set of features, that makes coding easier:

  • Debugging support
  • Syntax highlighting
  • Automatic code formatting
  • Saving and reloading code files
  • Running code from within the environment

Of course, there are lots of other features you might want, like source code control, an extension model, build and test tools, language help, and so on. But the above list is what I would see as the “core features”, that a very good editing environment should support.

With these features in mind, let’s take a look at some general purpose tools you can use, for Python development:

  • VIM
  • Atom
  • Notepad++
  • PyCharm
  • GNU Emacs
  • SublimeText
  • Visual Studio
  • Eclipse + PyDev

With that said, you now have multiple IDEs to select from. Please, tell me in the comments: Which one is best for you?


– Digital Academy™ 🎓

📖 Complete Python Development Course for Beginners

#Python #Tutorial #Beginners #Installation #Environment

***

♡ Thanks for watching and supporting ♡

Please Subscribe. Hit the notification bell.

Like, Comment and Share.

***

♡ FOLLOW US ♡

http://digital.academy.free.fr/

https://twitter.com/DigitalAcademyy

https://www.facebook.com/digitalacademyfr

https://www.instagram.com/digital_academy_fr

https://www.youtube.com/c/DigitalAcademyOnline

***

♡ SUPPORT US ♡
http://digital.academy.free.fr/join
http://digital.academy.free.fr/donate
http://digital.academy.free.fr/subscribe
https://www.patreon.com/digital_academy
https://www.buymeacoffee.com/digital_academy

Copy link
Powered by Social Snap