Using Python for Juniper on a Mac

Juniper Networks has developed a python library to manage their devices.  The library is called “junos-eznc” hosted at GitHub.  This library is meant to be able to handle commands programmatically that you would usually do at a CLI.  In order to use it, you will need to also install “ncclient” which implements NETCONF in python.  The easiest way to install is to use PIP.

MacPro:~ aaronpaxson$  sudo pip install ncclient
MacPro:~ aaronpaxson$  sudo pip install junos-eznc

If you receive an error regarding “error: ‘cc’ failed with exit status 1″, this is because you don’t have the C compiler installed.  At first, I thought I just needed to install XCode.  But, that’s not true.  You DO need XCode, but you also need to command-line tools for XCode.  To do that, run the command in Terminal “xcode-select –install”:

MacPro:~ aaronpaxson$  xcode-select --install

XCode-Select Terminal Tools

Choosing “Install” will install the correct tools.  Then, try again.

Share This Page : Share on TwitterShare on FacebookShare on GooglePlusShare on PinterestShare on Linkedin