简体   繁体   English

CMake 错误:找不到 PythonLibsUnix

[英]CMake Error : Could NOT find PythonLibsUnix

I have the following problem when I try to compile Blender :当我尝试编译Blender时出现以下问题:

Could NOT find PythonLibsUnix (missing: PYTHON_LIBRARY PYTHON_LIBPATH
PYTHON_INCLUDE_DIR PYTHON_INCLUDE_CONFIG_DIR)

OS: Ubuntu 20.04.操作系统:Ubuntu 20.04。

Thanks.谢谢。

I got the same error on openSUSE tumbleweed.我在 openSUSE tumbleweed 上遇到了同样的错误。 The error message is misleading, it actually requires a certain version of python, 3.9 in my case.该错误消息具有误导性,它实际上需要某个版本的 python,在我的情况下为 3.9。 I installed python39-devel package and the error went away.我安装了python39-devel package 并且错误消失了。

From Building Blender on Ubuntu在 Ubuntu 上构建搅拌机

To get the code first you run要首先获取代码,请运行

mkdir ~/blender-git
cd ~/blender-git
git clone https://git.blender.org/blender.git

And then you download the libraries.然后你下载库。 This is the missing PYTHON_LIBRARY that by default is looked into the directory above.这是缺少的 PYTHON_LIBRARY,默认情况下会在上面的目录中查找。

mkdir ~/blender-git/lib
cd ~/blender-git/lib
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux_centos7_x86_64

After that you can build normally from the source directory之后,您可以从源目录正常构建

cd ~/blender-git/blender
make update
make

This is a bit of a hack and maybe not the best solution, but it worked for me.这有点小技巧,也许不是最好的解决方案,但它对我有用。

I am going to assume you downloaded the precompiled libraries using我假设您使用下载了预编译库

mkdir ~/blender-git/lib
cd ~/blender-git/lib
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux_centos7_x86_64

All required libraries should be in that blender-git/lib directory.所有必需的库都应该在那个 blender-git/lib 目录中。

When running the make command, Cmake will automatically look for the libraries in the directory above.运行 make 命令时,Cmake 会自动在上面的目录中查找库。 I created a symbolic link in the directory above that points to the lib folder:我在上面的目录中创建了一个指向 lib 文件夹的符号链接:

 ~/blender-git$ cd ..
 ~/$ ln -s  blender-git/lib lib

Then running然后运行

~/$ cd blender-git 
~/blender-git$ make

should work, and will find all required libraries.应该可以工作,并且会找到所有必需的库。

I'm sure there is a better way to point Cmake to the right folder, but this hack worked for me.我确信有更好的方法将 Cmake 指向正确的文件夹,但这个 hack 对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM