gpt4 book ai didi

python - 将 scapy 导入 blender

转载 作者:太空宇宙 更新时间:2023-11-04 00:57:13 25 4
gpt4 key购买 nike

我正在尝试将 scapy 模块导入到 blender 中:

from bge import logic
import socket
from scapy.all import *

但我遇到了这个异常(exception):

enter image description here

我将 scapy 模块文件夹复制到:

C:\Program Files\Blender Foundation\Blender\2.75\scripts\modules

这是它包含的内容:

enter image description here

注意 all 和 base_classes 都在里面。

此外,我尝试在环境变量中添加 PYTHONPATH(我是不确定这是我必须做的..我也尝试添加

C:\Program Files\Blender Foundation\Blender\2.75\scripts\modules\scapy

在PATH和PYTHONPATH中都没有解决问题):

enter image description here

编辑:

sambler 所说的问题是我使用的 scapy 不支持 blender 使用的 python 3.x。所以我从这里下载支持 python 3.x 的更新的 scapy 版本:https://github.com/phaethon/scapy并用旧的 scapy 替换它,现在它可以工作了,但我无法嗅探、发送或接收数据包:

enter image description here

enter image description here

最佳答案

这个错误的直接原因是你在PYTHONPATH中没有C:\Program Files\Blender Foundation\Blender\2.75\scripts\modules环境变量。这不是特定的 Blender 问题,它是加载第三方包的一般 Python 要求。

您可以尝试将 PYTHONPATH 添加为全局每用户环境变量,如以下问题所述:How to add to the pythonpath in windows 7?

关于python - 将 scapy 导入 blender ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34555200/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com