Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify native library search path for python

Tags:

I have installed lxml which was built using a standalone version of libxml2. Reason for this was that the lxml needed a later version of libxml2 than what was currently installed.

When I use the lxml module how do I tell it (python) where to find the correct version of the libxml2 shared library?

like image 444
objects Avatar asked Jun 12 '09 05:06

objects


People also ask

How can we set the search path of the Python?

Set the environment variable PYTHONPATH to a colon-separated list of directories to search for imported modules. In your program, use sys. path. append('/path/to/search') to add the names of directories you want Python to search for imported modules.

How do I set the path for a Python module?

To make sure Python can always find the module.py , you need to: Place module.py in the folder where the program will execute. Include the folder that contains the module.py in the PYTHONPATH environment variable. Or you can place the module.py in one of the folders included in the PYTHONPATH variable.

Where is my Python library path?

For most Linux environments, Python is installed under /usr/local , and the libraries can be found there. For Mac OS, the home directory is under /Library/Frameworks/Python. framework . PYTHONPATH is used to add directories to the path.

How do I add a directory to a path in Python?

In the System variables section, selecting the Path variable and clicking on Edit. The next screen will show all the directories that are currently a part of the PATH variable. Clicking on New and entering Python's install directory.


1 Answers

Assuming you're talking about a .so file, it's not up to Python to find it -- it's up to the operating system's dynamic library loaded. For Linux, for example, LD_LIBRARY_PATH is the environment variable you need to set.

like image 108
Alex Martelli Avatar answered Oct 16 '22 07:10

Alex Martelli