To build Alexa skill you can use ASK SDK released by Alexa team which will help developers to concentrate more on skill logic. ASK SDK has been released for JAVA, Python, Node.js and C# language.
How to add ASK SDK for python
The ASK SDK for python requires Python 2 (2.7 +) and Python 3 (3.6 +). Make sure you have a supported version of Python installed. To check the version, from a command prompt run the following command:
- If python 3 installed in your system
$ python3 --version
- If python 2 installed in your system.
$ python --version
You can download and install the ASK SDK for python from the Python Package Index (PyPI) using command line tool (pip). If you are using Python 2 version 2.7.9 or later then you can
use “pip” or if you are using Python 3 version 3.4 or later then you can use “pip3” to install dependent libraries into your project.
There are two ways to install ASK SDK for python in your locale system:
- SDK in Virtual Environment
- SDK in specific folder
SDK in Virtual Environment
To install SDK in virtual environment you need to install “virtualenv” package. This package used to create isolated Python environment. To install follow below command to install package:
$ pip3 install virtualenv
Now create skill project by running below command and fill out asked information:
$ ask new
After creating Alexa skill navigate to the folder:
$ cd skill-project
Create virtual environment called skill_env by issuing below command:
$ virtualenv skill_env
Run below command to activate your virtual environment:
$ source skill_env/bin/activate
The command prompt should now be prefixed with (skill_env), indicating that you are working inside the virtual environment. Use the following command to install the ASK Python SDK:
(skill_env) $ pip3 install ask-sdk
Depending on the version of Python you are using, the SDK will be installed into the skill_env/lib/Python3.6/site-packages folder.
SDK in specific folder
First create skill project by running below command and also provide all required information:
$ ask new
Now navigate to your skill project directory:
$ cd skill-project
Next, install the ASK SDK for Python using pip. The -t option targets a specific folder for installation:
$ pip3 install ask-sdk -t python-library
This creates a folder named “python-library” inside your skill folder and installs the ASK SDK for Python and its dependencies.
Feel free to reach out to Developer Support Channel for any skill building support.