Search code examples
pythonpathpython-modulecondaanki

How to import third party python module Mac OS X - anki


I am relatively new to programming and posting to Stack Overflow. Please forgive my ignorance.

I am attempting to use a third party module in a program of my own, however I can't work out how to access the module within my Python script.

Mac OS X Sierra 10.12.4 Python 3.6.1 Anaconda 4.3.1

Specifically, I would like to be able to access anki (https://github.com/dae/anki).

I initially tried the line:

from anki import Collection

That resulted in a 'ModuleNotFoundError'.

Next I tried:

conda install anki

which also didn't work and yielded a 'PackageNotFoundError'

After more searching, I decided to try:

import sys
sys.path.append('usr/share/anki')
from anki import Collection

However, this also results in a 'ModuleNotFoundError'

What do I need to do to be able to access this module?

I am sure that it is possible because I have come across several other programs which make use of it:

-https://eshapard.github.io/anki/open-the-anki-database-from-python.html

I recognize that the link above purports to offer a solution to exactly this problem, however the solution proffered isn't working for me. Thanks in advance.


Solution

  • You are telling about Anki for desktop computers, which IS application written in Python, but it is NOT an installable Python package.

    So the commands like

    conda install anki
    

    or

    pip install anki
    

    have no meaning.

    So the only way is to download full source code of this project, unzip the content of it (only) folder into your project (change you actual folder to it) and then you may do import commands.