2 min read

Install python modules and libraries using IDLE on MAC

Python can be a great tool for Search Marketers allowing us to automate repetitive tasks and work with large data sets to analyse trends. This is ideal for marketing industries such as automotive and retail due to it’s saturation. If you’re new to python, there are a number of different issues you might run into even when setting up your environments. Below is one of the most common, highly relevant if you’re working through a guide or textbook such as Automate The Boring Stuff

If you’d like to discover what else python can do for you, such as how to get root domain from URL, make sure to check out our blog.

Import module works in Terminal but not in IDLE

When using python in IDLE on Mac, each python installation has it’s own …/lib/site-packages for 3rd party modules. Depending on your installation method (using the regular pip install package-name) terminal won’t allow you to import them when using IDLE.

This isn’t ideal, as there are a number of different libraries you won’t be able to live without – luckily this is easy to solve.

How to import Modules to IDLE on MAC

    1. Locate the system path

Enter “import sys; sys.executable” into your IDLE shell.

#Copy the below
import sys; sys.executable

This will give you your file path which will be needed in terminal, see step 1 image below.

    1. Open Terminal and Enter…

python-path -m pip install package-name

 

#Copy the line below along with your file/Python path
python-path -m pip install package-name
#Example with Python path:
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -m pip install matplotlib

This, for example, will install the Matplotlib plotting library

    1. Test if working

Terminal will now install, and your modules will work within IDLE. While this isn’t the most future-proofed way of doing things, it does allow you to get back to programming without having to worry.

Further information on IDLE

what is IDLE python?

IDLE stands for Integrated Development and Learning Environment. IDLE is essentially a simple IDE (Integrated Development Environment), suitable for Python novices and beginners, often used for educational purposes.

While IDLE is a great place to start, other IDEs offer far more functionality. My personal favourite is Pycharm made by JetBrain, I’d recommend giving it a try as it integrates tools and libraries such as NumPy and Matplotlib while also supporting other widely used programming languages.

For any more information on search, or digital marketing servicesget in touch.



Images for reference

Step 1

Honcho Python Screenshot: import sys; sys.executable

Step 2

Honcho Python terminal

*I already have the library installed so the requirements are already satisfied

Explore Our Services

DIGITAL PR 

Earn authoritative links and drive brand awareness with Digital PR

PAID SEARCH

Deliver instant traffic and revenue through Paid Search and Shopping

SOCIAL ADS

Reach new audiences and retarget existing ones on social channels 

CONTENT

Attract and engage website visitors with a well executed content strategy

Latest Blog Posts

Technical SEO Tips to Boost Your BFCM Sales

2 min read

Technical SEO Tips to Boost Your BFCM Sales

Increase your Black Friday and Cyber Monday sales with these crucial technical SEO tips.

Read More
Content Marketing Tips for Ecommerce Success This BFCM

2 min read

Content Marketing Tips for Ecommerce Success This BFCM

Black Friday and Cyber Monday (BFCM) are just around the corner. Boost your content marketing strategy to drive traffic, engage customers, and...

Read More
The Role of Artificial Intelligence (AI) in Content Creation

5 min read

The Role of Artificial Intelligence (AI) in Content Creation

Discover how artificial intelligence is changing the way we create, curate, and optimise content across various platforms.

Read More