I have a python script (parser.py) which imports crc32c like this:
import crc32c
// ... rest of the code
I have installed crc32c with the command:
arch -arm64 brew install crc32c
crc32c was installed here:
/opt/homebrew/Cellar/crc32c/1.1.1
When executing parser.py file like this:
python3.9 parser.py
Getting this error:
ModuleNotFoundError: No module named 'crc32c'
What is the way to show to the parser.py file, that crc32c is installed into particular directory?
I have tried doing like this:
sys.path.append('/opt/homebrew/Cellar/crc32c')
As well looked into similar question, but can not found solution for my problem.
CodePudding user response:
try
sys.path.append('/opt/homebrew/Cellar/')
or, if the package is inside /opt/homebrew/Cellar/crc32c/1.1.1
(this folder contains a package (=another folder) called crc32c
)
sys.path.append('/opt/homebrew/Cellar/crc32/1.1.1/')
before importing the module.
you can try to debug this by calling help('modules')
in your code after the sys.path.append
has been called
CodePudding user response:
Unfortunately it looks like that isn't a python package:
https://formulae.brew.sh/formula/crc32c
https://github.com/google/crc32c
There are python checksums available, for instance:
https://pypi.org/project/crc32c/ python3.9 -m pip install crc32c
and zlib.crc32()
That look like they may suit your needs