Python Tutorial for Digital Marketers 1: Install and Set up Python for Mac

Digital marketing has become so sophisticated and data-oriented in the present-day marketing field. The modern digital marketing strategies and on-going performance optimization are highly influenced by first-hand external data and deeper in-house data analytics. No matter what marketing position you are in, or what business model you’re running.

Too many application scenarios to illustrate the benefits of Python for digital markets, but the main goal of a successful digital marketing strategy is to achieve the marketing return on investment ROI greater and faster, which is impossible without using the technologies like Python for automating the process.

Digital marketing has become so sophisticated and data-oriented in the present-day marketing field. First-hand external data and deeper in-house data analytics influence digital marketing strategies and performance optimization. No matter what marketing position you are in, or what business model you’re running.

If you were an eCommerce marketer

Python must be your good partner to automatically index supplier and opponent product market pricing information. They are integrated with your profit calculator, for example, specify to fetch and scrape web data.

If you were a social media marketer

Python can help you automatically scrape a list of the right potential collaborated influencer profiles from multi-social channels. It’s based on what post they blast and what content are, for example, Scrape Youtubers’ video via Youtube API, scrape top Instagram posts and user profiles.

  • If you were a search engine marketer, a large number of matters related to SEO, such as 404 errors, meta tags, descriptions, robot text files, content duplication, etc. A Python script can easily detect those elements for automating the SEO process.
  • If you were a B2B marketer, Python can scrape a huge amount of target leads’ email addresses. Then it consolidates a list of organized data in your excel file
  • If you were a paid media marketer, Python custom codes can make life so easy in monitoring the ads, effectiveness, clicks, checkouts, conversion rate, and other parameters in real-time. You can integrate all the data with your finance table.

There are too many application scenarios to illustrate all benefits of Python for digital markets. But the main goal of a successful digital marketing strategy is to achieve the marketing return on investment ROI greater and faster. It is impossible without using the technologies like Python for automating the process.

So based on my past agency and client-side experience, in this Python Tutorial, I’ll attempt to share a collection of Python Tutorials for digital marketers. And in this Python Tutorial, I would start how to install and set up Python3, and I’ll take Mac as an example.

1. Python Tutorial: Set up Python 3

  • Check Mac Default Python Version

Before downloading and installing the latest Python version, it might be better to open a Mac notebook terminal and check which default Python version is being run in your Mac notebook. 

The reason we suggest you do this action is that for the Mac notebook, Python 2.7 is pre-installed. But an out-of-date version of Python, version 2.7 which was officially deprecated on January 1st, 2020. This means you need to update it to version 3,  before building any new projects in your local development environment. So we can go to Terminal and check if your Mac notebook is still equipped with the default Python version.

And as you can see from the screencap after typing in the python –version, my Macbook Python version is 2.7.16. So for using Python 3, we need to go to download the Python3 version.

python 2.7

  • Download and Install the latest Python 3 Version 

Python 3 is an open-source file, and you can go to this website and download it. After you complete the download, it’s very straightforward to open the file and proceed with the installation as well as the other App installation process.

python 3.9

  • Why Mac version is still Python2 after having installed Python3

After you install the Python3, you can go back to the terminal and type in 

python --version

However as you can see from the screencap, you find out the default version is still Python2. The reason for this is because the installation process is just to create a command of Python3, rather than replacing the default version. If you type in 

python3 --version

You can find the result in python 3.9.0, which means you’ve installed the Python3 command and you can use it to activate value.

Being said that you can create an association between python and python3 in your Mac notebook by using alias ($ nano ~/.bash_profile). But I’m not going to deep dive into details here, but I’ll elaborate on this association in the coming chapters of the Python tutorial.

2. Python Tutorial: Test Python3 and Run your first Python code & file

  • Test Python3 by running the code

Now you can test the function running within the Python3 shell in your Mac terminal. 

First of all, you can type in python3, and you can see there’s a new section coming up in the terminal. This is a shell you can run python code and function.

For example, you can input some function such as:

print(‘heelo’)

Or create a variable

1) X = 10

2) print(x)

python codes and functions

  • Create a python script file by using a plain text editor (Take Idle as an example)

Apart from running a single line of code and function, you can test to create a py file for running in Mac terminal later. There are many free available Python editors you can use out there, such as sublime text. And here I’ll take Idle as an example because it comes along with the downloaded Python file.

idle editor

You can double click idle and there’s a window coming up that is the idle shell for you to run codes and functions

idle shell interface

Then, you can create a new file and create a single line of code, and save as a new .py file

print(‘hello’)

new py file

3. Python Tutorial: Run the python script file in Mac Terminal

The python script file currently is pretty simple, but in the future when you pick up the advanced web scraping skills, this is the module you might create and use for scraping your opponent’s huge line of product pricing.

Back to the Mac terminal, you can try to run this .py file there. Before typing in the code, please copy the .py file path, or you can use a shortcut path expression like below.

Python3 ~/desktop/intro.py

Just kindly remind to use command python3, because the default Mac Python is still the 2.0 version

When this step is done, it proves that you have successfully installed Python3.

I hope you enjoy reading Python Tutorial for Digital Marketers 1: Install and Set up Python for Mac. If you did, please support us by doing one of the things listed below, because it always helps out our channel.

  • Support my channel through PayPal (paypal.me/Easy2digital)
  • Subscribe to my channel and turn on the notification bell Easy2Digital Youtube channel.
  • Follow and like my page Easy2Digital Facebook page
  • Share the article to your social network with the hashtag #easy2digital
  • Buy products with Easy2Digital 10% OFF Discount code (Easy2DigitalNewBuyers2021)
  • You sign up for our weekly newsletter to receive Easy2Digital latest articles, videos, and discount code on Buyfromlo products and digital software
  • Subscribe to our monthly membership through Patreon to enjoy exclusive benefits (www.patreon.com/louisludigital)

If you are interested in learning the next chapter, please click the article below

Python Tutorial for Digital Marketers 2: Web Scraping with BeautifulSoup, Requests, Sublime Text

Leave a Reply

Your email address will not be published. Required fields are marked *