Steps to check when pythonnet failing to install via pip

Article Image

If you are trying to install pythonnet using pip and you are getting errors while installing it on MAC OSX you can follow below steps to remove the error and install it.

Check if pkg-config is installed

If not installed run the below command to install on MAC OSX

brew install pkg-config 

Check if mono.pc file is on the system

The reason for the error maybe because it is not getting the path of mono-2 means mono.pc or mono-2.pc file. If mono is not installed on your system you can install it from below link.

https://www.mono-project.com/download/stable/#download-mac

After installing the mono-project find the location of mono.pc you can run the below commands to find its path

sudo find / -name "mono.pc"

It will print the mono path in terminal like this  /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/pkgconfig/mono.pc

Export mono path or add in .bash_profile

To export the path variable PKG_CONFIG_PATH, use below command

export PKG_CONFIG_PATH="/Library/Frameworks/Mono.framework/Versions/6.10.0/lib/pkgconfig":$PKG_CONFIG_PATH

Now run "pip install pythonnet" command and check if it executes successfully. If it is installed you are good to go if not please ask on Devsheet or post your error in comment section.

0 Comments
Write new article
Never leave your website again in search of code snippets by installing our chrome extension.