简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM