如何在 Ubuntu 20.04(WSL)中构建 Blender 以便我可以将 bpy 导入 python?

如何在 Ubuntu 20.04(WSL)中构建 Blender 以便我可以将 bpy 导入 python?

我尝试过的:

github repo 导入bpy,所以我尝试了

  1. 通过 git clone 构建 Blender但该install_deps.sh命令失败,因为它无法安装请求的包libpystring-dev

  2. pip install bpy- 没有。

  3. 这家伙的写作开始取得一些进展,但在表面上成功的运行之后仍然没有被识别的 bpy 模块。

因为我需要在我的 WSL Ubuntu 中安装 Blender,所以我不确定该如何做。

相应的错误:

1.通过 git clone 构建Blender:

 ./blender/build_files/build_environment/install_deps.sh
WARNING! ****WARNING****
If you are experiencing issues building Blender, _*TRY A FRESH, CLEAN BUILD FIRST*_!
The same goes for install_deps itself, if you encounter issues, please first erase everything in /home/domattioli/src/blender-deps and /opt/lib
(provided obviously you did not add anything yourself in those dirs!), and run install_deps.sh again!
Often, changes in the libs built by this script, or in your distro package, cannot be handled simply, so...

You may also try to use the '--build-foo' options to bypass your distribution's packages
for some troublesome/buggy libraries...


Ran with:
    install_deps.sh



Installing dependencies for DEB-based distribution

Source code of dependencies needed to be compiled will be downloaded and extracted into '/home/domattioli/src/blender-deps'.
Built libs of dependencies needed to be compiled will be installed into '/opt/lib'.
Please edit $SRC and/or $INST variables at the beginning of this script,
or use --source/--install options, if you want to use other paths!

Number of threads for building: 24 (automatically detected, use --threads=<nbr> to override it).
Full install: false (use --with-all option to enable it).
Building OpenCOLLADA: false (use --with-opencollada option to enable it).
Building Embree: false (use --with-embree option to enable it).
Building OpenImageDenoise: false (use --with-oidn option to enable it).

Example:
Full install without OpenCOLLADA: --with-all --skip-opencollada

Use --help to show all available options!

Do you want to continue (Y/n)?y
Get:1 file:/var/cuda-repo-wsl-ubuntu-11-7-local  InRelease [1575 B]
Get:1 file:/var/cuda-repo-wsl-ubuntu-11-7-local  InRelease [1575 B]
Get:2 file:/var/cudnn-local-repo-ubuntu2004-8.4.1.50  InRelease [1575 B]
Get:2 file:/var/cudnn-local-repo-ubuntu2004-8.4.1.50  InRelease [1575 B]
Get:3 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64  InRelease [1484 B]
Get:4 https://nvidia.github.io/nvidia-container-runtime/stable/ubuntu18.04/amd64  InRelease [1481 B]
Get:5 https://nvidia.github.io/nvidia-docker/ubuntu18.04/amd64  InRelease [1474 B]
Hit:6 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease
Hit:7 http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  InRelease
Hit:8 https://arkane-systems.github.io/wsl-transdebian/apt focal InRelease
Get:9 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:10 https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64  InRelease
Hit:11 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu focal InRelease
Hit:12 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:13 http://archive.canonical.com/ubuntu focal InRelease
Get:14 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Hit:15 http://ppa.launchpad.net/saiarcot895/chromium-dev/ubuntu focal InRelease
Hit:16 http://ppa.launchpad.net/thomas-schiex/blender/ubuntu focal InRelease
Get:17 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Fetched 340 kB in 1s (399 kB/s)
Reading package lists... Done




Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libfontconfig1-dev' instead of 'libfontconfig-dev'
E: Unable to locate package libpystring-dev
ERROR! apt-get failed to install requested packages, exiting.

2.pip 安装 bpy:

pip install bpy
Collecting bpy
  Using cached bpy-0.0.0a0.tar.gz (19 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/domattioli/miniconda3/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qiee2cmh/bpy_a414fb89254042aa8aa952fca27c77e4/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qiee2cmh/bpy_a414fb89254042aa8aa952fca27c77e4/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-ojmq4blc
         cwd: /tmp/pip-install-qiee2cmh/bpy_a414fb89254042aa8aa952fca27c77e4/
    Complete output (16 lines):
    Traceback (most recent call last):
      File "/home/domattioli/miniconda3/lib/python3.9/tokenize.py", line 342, in find_cookie
        codec = lookup(encoding)
    LookupError: unknown encoding: future_fstrings

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/domattioli/miniconda3/lib/python3.9/tokenize.py", line 394, in open
        encoding, lines = detect_encoding(buffer.readline)
      File "/home/domattioli/miniconda3/lib/python3.9/tokenize.py", line 381, in detect_encoding
        encoding = find_cookie(second)
      File "/home/domattioli/miniconda3/lib/python3.9/tokenize.py", line 350, in find_cookie
        raise SyntaxError(msg)
    SyntaxError: unknown encoding for '/tmp/pip-install-qiee2cmh/bpy_a414fb89254042aa8aa952fca27c77e4/setup.py': future_fstrings
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/bc/e2/20c6d56f1143e13c0fc24a7d987ee28e4949b8edbbbb1b66f705d129bdc5/bpy-0.0.0a0.tar.gz#sha256=b48c0348cccaf9ad316bccd3dc65fdc8422e4c310c79c85448b01ae7feb7f02e (from https://pypi.org/simple/bpy/) (requires-python:>=3.4.0). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement bpy (from versions: 0.0.0a0)
ERROR: No matching distribution found for bpy
  1. Github 记录:
domattioli@DSI-8VD8XP3:/usr/include/blender-git/lib/linux_centos7_x86_64/python/bin$ ls
python3.10  python3.7m  python3.9
(base) domattioli@DSI-8VD8XP3:/usr/include/blender-git/lib/linux_centos7_x86_64/python/bin$ python3.9
Python 3.9.12 (main, Apr  5 2022, 06:56:58)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import bpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'bpy'
>>>

相关内容