Command-line interface

How to Install Python on Windows

Python doesn’t come prepackaged with Windows, but that doesn’t mean Windows users won’t find the flexible programming language useful. It’s not quite a simple as installing the newest version however, so let’s make sure you get the right tools for the task at hand.

First released in 1991, Python is a popular high-level programming language used for general purpose programming. Thanks to a design philosophy that emphasizes readability it has long been a favorite of hobby coders and serious programmers alike. Not only is it an easy language (comparatively speaking, that is) to pick up but you’ll find thousands of projects online that require you have Python installed to use the program.

Which Version Do You Need?

Unfortunately, there was a significant update to Python several years ago that created a big split between Python versions. This can make things a bit confusing to newcomers, but don’t worry. We’ll walk you through installing both major versions

When you visit the Python for Windows download page, you’ll immediately see the division. Right at the top, square and center, the repository asks if you want the latest release of Python 2 or Python 3 (2.7.13 and 3.6.1, respectively, as of this tutorial).

Newer is better, right? Maybe so, maybe not. The version you want depends on your end goal. Let’s say, for example, that you read our article about expanding your Minecraft world with MCDungeon and are excited to add cool stuff to your worlds. That project is coded in Python and requires Python 2.7—you can’t run the MCDungeon project with Python 3.6. In fact, if you’re exploring hobby projects like MCDungeon, you’ll find that nearly all of them use 2.7. If your goal is to get some project that ends in a “.py” extension up and running, then there’s a very, very good chance you’ll need 2.7 for it.

On the other hand, if you’re looking to actually learn Python, we recommend installing both versions side by side (which you can do with zero risk and only a tiny bit of setup hassle). This lets you work with the newest version of the language, but also run older Python scripts (and test backwards compatibility for newer projects). Comparing the two versions is an article unto itself, though, so we’ll defer to the Python project wiki where you can read their well written overview of the differences.

You can download just Python 2 or Python 3 if you’re sure you only need a particular version. We’re going the distance today and will be installing both of them, so we recommend you download both versions and do the same. Under the main entry for both versions you’ll see an “x86-64” installer, as seen below.

This installer will install the appropriate 32-bit or 64-bit version on your computer automatically (here’s some further reading if you want to know more about the differences between the two).

How to Install Python 2

Installing Python 2 is a snap, and unlike in years past, the installer will even set the path variable for you (something we’ll be getting into a bit later). Run the installer, select “Install for all users,” and then click “Next.”

On the directory selection screen, leave the directory as “Python27” and click “Next.”

On the customization screen,…

Give Your Products the Power of Speech Using Amazon Polly

Would you like to get your products more deeply integrated into your customers’ daily lives?

Of course, what business wouldn’t.

An important first step towards making that happen is to give your products the ability to interact with your customers on their own terms. And the easiest way to do that is through natural speech.

The Power of Spoken Language

Human beings have been speaking to each other since the dawn of time. Speech is our most natural form of communication — and one of the reasons why we’ve been so successful as a species.

So let’s dive into what it takes to give your applications and devices the ability to speak in a manner that’s natural and comfortable to your customers.

Recent advancements in artificial intelligence have made this super easy, so it’ll be quick.

Got 5 Minutes?

This short guide will walk you through converting written text into a spoken audio file using the Amazon Polly text-to-speech service.

Note: Amazon Polly only provides a one-way speech capability — converting written text into spoken audio (text-to-speech). If you want to be able to understand spoken audio as well, you’ll additionally need a speech-to-text service, like Amazon Lex.

An easy on ramp for A.I.

This is a how-to guide intended for developers or tech-savvy business leaders looking for a proven entry point into A.I.-powered business systems.

The scripts we’ll be using are simple and easy to read — Amazon’s SDK has already done most of the heavy lifting for you.

So let’s get right to it…

What You’ll Need

Right off the bat, let’s get the initial requirements knocked out.

Download the source repository.

To start, let’s pull down the source files. (You’ll need a git client installed on your computer for this step.)

And for a change of pace, we’re going to use PHP for these scripts. You’ll need a command line interpreter for PHP installed and Composer.

Note: If you prefer a different programming language, AWS provides SDKs for nearly every major language — and the scripts are very easy to port over.

Move to the directory you want to use for this demo and run the following commands in a terminal…

# Download source repository & install dependencies git clone https://github.com/10xNation/amazon-polly-demo-php.git cd amazon-polly-demo-php composer install 

Feel free to leave the terminal window open — you’ll need it soon.

Create an AWS account.

If you don’t already have an AWS account, go ahead and set one up.

Verify user permissions.

And if you aren’t using an administrator-level user account for AWS, you’ll need to make sure your account has full control over the Polly service.

Enter your credentials.

You’ll need to enter your API credentials into the script files. And you can do that by opening speak_text.php and speak_ssml.php and editing the following section in both files…

 'credentials' => [ // Change these to your respective AWS credentials  'key' => 'XXXXXXXXXXXXXXXXXXXX',  'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',  ] 

The Best Keyboard Shortcuts for Bash (aka the Linux and macOS Terminal)

Bash is the default command-line shell on most Linux distributions, from Ubuntu and Debian to Red Hat and Fedora. Bash is also the default shell included with macOS, and you can install a Linux-based bash environment on Windows 10.

The bash shell features a wide variety of keyboard shortcuts you can use. These will work in bash on any operating system. Some of them may not work if you’re accessing bash remotely through an SSH or telnet session, depending on how you have your keys mapped.

Want to Learn More? Get Linux Training from the Linux Foundation

Learn everything you could want to know about Linux with comprehensive online Linux courses and certification tests that include the real-world experience and first-hand knowledge of what it takes to be a successful Linux developer or system administration professional, all from a web browser in the comfort of your home.

The Linux Foundation is the nonprofit consortium dedicated to fostering the growth of Linux. Founded in 2000, they are supported by the leading technology companies and developers from around the world.

Working With Processes

Use the following shortcuts to manage running processes.

  • Ctrl+C: Interrupt (kill) the current foreground process running in in the terminal. This sends the SIGINT signal to the process, which is technically just a request—most processes will honor it, but some may ignore it.
  • Ctrl+Z: Suspend the current foreground process running in bash. This sends the SIGTSTP signal to the process. To return the process to the foreground later, use the fg process_name command.
  • Ctrl+D: Close the bash shell. This sends an EOF (End-of-file) marker to bash, and bash exits when it receives this marker. This is similar to running the exit command.

Controlling the Screen

The following shortcuts allow you to control what appears on the screen.

  • Ctrl+L: Clear the screen. This is similar to running the “clear” command.
  • Ctrl+S: Stop all output to the screen. This is particularly useful when running commands with a lot of long, verbose output, but you don’t want to stop the command itself with Ctrl+C.
  • Ctrl+Q: Resume output to the screen after stopping it with Ctrl+S.

Moving the Cursor

Use the following shortcuts to quickly move the cursor around the current line while typing a command.

  • Ctrl+A or Home: Go to the beginning of the line.
  • Ctrl+E or End: Go to the end of the line.
  • Alt+B: Go left (back) one word.
  • Ctrl+B: Go left (back) one character.
  • Alt+F: Go right (forward) one word.
  • Ctrl+F: Go right (forward) one character.
  • Ctrl+XX: Move between the beginning of the line and the current…

Is It Possible to Clear the History in the Windows Command Prompt?

If you use the Windows command prompt often throughout your work day, you may want or need to periodically clear the command history. Is it possible to do so while the command prompt is still open? Today’s SuperUser Q&A post has the answer to a curious reader’s question.

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

SuperUser reader Alexander B. wants to know if it is possible to clear the history in the Windows command prompt:

When using the Windows command…