0

I try the following code to see if the library sodium can be located

import ctypes
import ctypes.util

# Taken from line 33 https://github.com/bgaifullin/pysodium/blob/master/pysodium/__init__.py

o = ctypes.util.find_library('sodium')

print o

This always returns "none"

Please how do I add external libraries (dependencies) and reference them correctly in my python code.

EDIT:

I am trying to work with pysodium it has a dependency on libsodium

I have downloaded libsodium, but i'm new to python...

I'm actually using PTVS 2.1 to get up to speed running python in my familiar dev environment.

Charles Okwuagwu
  • 10,538
  • 16
  • 87
  • 157

1 Answers1

3

If I understood you correctly. What you want is to import a library. Put the pysodium directory under the script you want to use and then simply do

import pysodium

It is as simple as that.

Usually, what you do is install the libraries on your system, or in a virtualenv, and import them to your python script. Cloning the repository will not generally help unless the libraries you want to import are in the same directory as the script you're importing from.

I, personally, would recommend using virtualenv and pip together hand in hand. Read up on virtualenv, it will come very handy.

Assuming you have both virtualenv and pip, all you need to do is the following

virtualenv venv
source venv/bin/activate
pip install pysodium

This should create a virtualenv container, activate it and install pysodium inside. Your script will only work when the virtualenv is activated. You can deactivate it using the command deactivate.

Digisec
  • 700
  • 5
  • 9