lru_cache
lru_cache copied to clipboard
Problem in importing LruCache
I installed lru_cache properly with $ pip install lru_cache
$ pip show lru_cache
Name: lru-cache
Version: 0.2.3
Summary: thread safe lru cache
Home-page: https://github.com/acmerfight/lru_cache
Author: acmerfight
Author-email: [email protected]
License: MIT
Location: /usr/local/lib/python3.6/dist-packages
But when I importing this library, encountered with this error:
In [1]: from cache import LruCache
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-2bf864cf4d52> in <module>()
----> 1 from cache import LruCache
/usr/local/lib/python3.6/dist-packages/cache/__init__.py in <module>()
----> 1 from lru_cache import LruCache
ModuleNotFoundError: No module named 'lru_cache'
Are you running Python 3?
It is probably a problem with relative path.
I got it working by modifying __init__.py
to have relative path:
- from lru_cache import LruCache
+ from .lru_cache import LruCache
不兼容 python3 @acmerfight :doge:
solved
@acmerfight However, the problem still remains. Please check the pull request on your repo.