无法进口模块yara
我目前正在尝试运行 Volatility3,但遇到了由于 yara 导入失败而导致的错误。
主要问题是,即使在 CMD 上,我也无法通过输入 python
然后输入 import yara
来导入 yara,这样做会收到如下错误:
FileNotFoundError: Could not找到模块'C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\DLLs\libyara.dll'(或其依赖项之一)。尝试使用带有构造函数语法的完整路径
。
完全错误
Failed to import 'C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\DLLs\libyara.dll'
PATH = (***other programs within the path such as git***);C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\DLLs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yara\__init__.py", line 7, in <module>
from yara.rules import compile
File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yara\rules.py", line 17, in <module>
from yara.libyara_wrapper import *
File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yara\libyara_wrapper.py", line 315, in <module>
libyaradll = cdll.LoadLibrary(library)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\DLLs\libyara.dll' (or one of its dependencies). Try using the full path with constructor syntax.
这些是我尝试过的一些内容
- 从 Github 安装 yara 源并运行 setup.py 没有任何错误
- 通过 pip 卸载并重新安装
- 运行requirement.txt,它说我已经满足了要求
其他一些说明:
我的操作系统是Win11
我的python版本是3.9.12
根据我收到的错误,我相信 libyara 库丢失了,我尝试在网上查找许多其他解决方案,但没有解决这个问题。就此事提供的任何帮助将不胜感激。
I am currently attempting to run Volatility3, but I have encountered an error which is caused by yara failing on import.
The main issue is I am unable to import yara even on CMD by typing python
then import yara
, doing so would get an error like this:
FileNotFoundError: Could not find module 'C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\DLLs\libyara.dll' (or one of its dependencies). Try using the full path with constructor syntax
.
Full Error
Failed to import 'C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\DLLs\libyara.dll'
PATH = (***other programs within the path such as git***);C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\DLLs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yara\__init__.py", line 7, in <module>
from yara.rules import compile
File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yara\rules.py", line 17, in <module>
from yara.libyara_wrapper import *
File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yara\libyara_wrapper.py", line 315, in <module>
libyaradll = cdll.LoadLibrary(library)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\DLLs\libyara.dll' (or one of its dependencies). Try using the full path with constructor syntax.
These are some of the stuff I've attempted
- Installing yara source from Github and and running setup.py without any errors
- Uninstalled and reinstalled via pip
- Run requirement.txt, it says I've fulfilled the requirements
Some other notes:
My OS is Win11
My python version is 3.9.12
Based on the error I received, I believe the libyara library is missing, I've tried looking up on many other solutions online but no luck on fixing this issue. Any help provided on this matter will be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然这不是最好的解决方案,但我对此问题的解决方案是不使用Windows进行波动3。
如果您在Windows机器上,只需使用VM并将任何Linux发行版插入其中,它将立即工作(当时我正在使用Kali)。这或多或少解决了我面临的问题,并从波动性方面得到了我想要的东西3。
编辑:
这似乎是Python3的特定问题,如果通过Microsoft Store安装,我尝试使用
scoop.sh
之类的东西重新安装Python3,并且已经解决了问题。While this is not the best solution, my solution of this issue is to not use Windows for Volatility3.
If you are on a windows machine, just use a VM and plug any Linux distro into it and it will work instantly (at that time I was using Kali). This more or less resolved the issue I was facing and got what I wanted from memory forensic on Volatility3.
Edit:
This seems like a specific issue to python3 if installed via Microsoft Store, I tried reinstalling Python3 with stuff like
Scoop.sh
and I have fixed the issue.