[英]No module named 'bpy' but it's installed
I've been trying to install bpy for a few hours.我已经尝试安装 bpy 几个小时了。 I used 'pip install bpy', and got some errors about the 'bpy_types' module.我使用了“pip install bpy”,但遇到了一些关于“bpy_types”模块的错误。 I followed this thread and found the bpy_post_install executable.我关注了这个线程并找到了 bpy_post_install 可执行文件。 I also tried the steps involving the 2.82 folder from \Scripts.我还尝试了涉及 \Scripts 中的 2.82 文件夹的步骤。 After I ran bpy_post_install, python is unable to find bpy whatsoever when I run through VSCode.在我运行 bpy_post_install 之后,当我运行 VSCode 时,python 无论如何都找不到 bpy。 I run python3 __init__.py
and get error line 4, in <module> import bpy ModuleNotFoundError: No module named 'bpy'
.我运行python3 __init__.py
并line 4, in <module> import bpy ModuleNotFoundError: No module named 'bpy'
。 I then attempt pip install bpy
and get Requirement already satisfied: bpy in C:\users\... (2.82)
.然后我尝试pip install bpy
并获得Requirement already satisfied: bpy in C:\users\... (2.82)
。
I'm pretty much at a loss, I've never seen python claim a module wasn't installed when it clearly is.我几乎不知所措,我从来没有见过 python 声称一个模块没有安装,而它显然是。
I see that you're having an issue with bpy seeming not to be "installed" (I put that in air quotes since you obviously installed it with the terminal.)我看到您遇到了 bpy 似乎没有被“安装”的问题(我把它放在引号中,因为您显然是用终端安装的。)
Firstly I watched this video - Blender Addon #1 - Python Programming Introduction (Bpy module, data, Context and Types) Which gave me some useful insight into both the bpy module and how you can use it.首先,我观看了这个视频 - Blender Addon #1 - Python Programming Introduction(Bpy 模块、数据、上下文和类型),它让我对 bpy 模块以及如何使用它有了一些有用的见解。
In the video he breaks down some of these things so you don't have to watch an 18 minute video.在视频中,他分解了其中一些内容,因此您不必观看 18 分钟的视频。
Prerequisites?先决条件?
His tutorial Scripting Tab under the application name, window, and exit buttons very far right.他的教程Scripting Tab 下的应用程序名称、窗口和退出按钮非常靠右。
It opens something called a REPL window它打开一个叫做 REPL 窗口的东西
When I tried this it worked, and also did not work which is seemly weird当我尝试这个时,它起作用了,也没有起作用,这似乎很奇怪
When I opened one of my complex modules that I was going to use for Three.Js
it worked flawlessly - type bpy and then hit tab it should show up with all of the prefill answers当我打开我打算用于Three.Js
的一个复杂模块时,它完美地工作 -输入 bpy 然后点击选项卡,它应该会显示所有预填答案
However, when I used a new blender file with the cube it started giving me errors.但是,当我对立方体使用新的搅拌机文件时,它开始给我错误。
Now about the error you are facing here is what I found现在关于您在这里面临的错误是我发现的
Blender Stack exchange搅拌机堆栈交换
Github Github
What is conda?什么是康达?
Difference between conda and pip conda 和 pip 的区别
To get bpy to work with the Conda Method mentioned above.让 bpy 使用上面提到的 Conda 方法。
After installing Conda run this line of code mentioned in the GitHub method above安装 Conda 后运行上面 GitHub 方法中提到的这行代码
conda install -c kitsune.one python-blender
Alternative Method替代方法
Within the GitHub thread xiezhongzhao said you could install fake-bpy.在 GitHub 线程中 xiezhongzhao 说你可以安装 fake-bpy。 Link to fake-bpy链接到 fake-bpy
The line he mentions to run is:他提到要运行的线路是:
pip install fake-bpy-module-2.80 pip install fake-bpy-module-2.80
However I recommend running this line instead, and it's mentioned in the GitHub repo above但是我建议改为运行这一行,它在上面的 GitHub 存储库中提到
pip install fake-bpy-module-latest
I recommend this since it will be the latest version not a specific blender version我推荐这个,因为它将是最新版本而不是特定的搅拌机版本
However, people within that GitHub thread have said they are still getting errors related to bpy within Python so try it and let me know.但是,该 GitHub 线程中的人表示,他们仍然在 Python 中遇到与 bpy 相关的错误,因此请尝试并告诉我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.