Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 07-11-2017, 04:48 PM   #1
Registered: Mar 2017
Location: Bremen, KS
Distribution: Debian Buster
Posts: 41

Rep: Reputation: 43
Python extension module installed in /usr/local/lib[64]/python[2.7|3.x]/site-packages not found

I am part of a team that develops and maintains a C library that is built using GNU Autotools with various language bindings generated by SWIG including Python. When I do local builds for testing, make install puts everything under the /usr/local hierarchy which keeps it nicely separated from the Slackware system hierarchy.

I am just getting started using Slackware64 Current as a daily runner on my laptop and I did a compile and install of the library with Python language bindings and could not import the extension module. Checking sys.path from the Python interpreter showed no paths into the /usr/local hierarchy.

Previously I had developed on Debian based systems and the extension module installed into the /usr/local hierarchy "just worked", so this a new twist for me.

I'm aware that this can be resolved at run time by juggling the PYTHONPATH environment variable, but that is going to get tedious quickly when jumping between Python 2.7 and 3.6. I'm sure there are ways to deal with this at the script level as well, but I would like to have a solution that I could set in this system so that either version Python can find its relevant extension module.

As I understand it, this does not affect the SBo build scripts of the same library that I maintain, just the source builds installed via GNU Autotools.

Old 07-11-2017, 11:06 PM   #2
Registered: Mar 2012
Distribution: Slackware, CentOS, OpenBSD, FreeBSD
Posts: 515

Rep: Reputation: Disabled
Hi there!

I have 2 solutions for this which might work:

1) Define PYTHONPATH in an /etc/profile.d script and then export it so you don't have to worry about it (at runtime either).

2) Since sys.path is just a list (in the python sense), you can simply append the respective directory with
# Or perhaps you'd like to check first: if "/path/to/whereever" not in sys.path: sys.path.append("/path/to/whereever")
I believe both solutions should work for both python2 and python3.
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Python YUM Module not found von_vea Linux - General 2 07-28-2009 09:42 PM
LXer: Move to python 2.4 / Changing the packaging style for python packages LXer Syndicated Linux News 0 06-13-2006 08:54 PM
Libs being installed to /usr/local/lib? Archer36 Slackware 3 01-26-2006 12:52 AM
can't open file /usr/lib/python/ while installing plucker. dr_zayus69 Linux - Software 4 11-01-2005 12:11 PM
Cant install unsatisfied /usr/local/bin/python/ Fredstar Linux - Newbie 1 02-02-2005 02:12 AM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:31 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration