有一些先前的问题,最值得注意的是,但他们没有帮助我。我试图安装 llvm 版本 10(或 9),因为它是这皮奥德Python 包。尝试安装时,出现此错误:
(.venv) user@desktop:/media/Projects/outliers$ pip install llvmlite
Collecting llvmlite
Using cached https://files.pythonhosted.org/packages/0b/96/07bfa93a103fb9e3e9ae7f9f7c6687ae714aee66b6f3000da3fad71e0aa2/llvmlite-0.34.0.tar.gz
Building wheels for collected packages: llvmlite
Running setup.py bdist_wheel for llvmlite ... error
Complete output from command /media/Projects/outliers/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-a4jzbt70/llvmlite/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpzu8welrdpip-wheel- --python-tag cp36:
running bdist_wheel
/media/Projects/outliers/.venv/bin/python3 /tmp/pip-build-a4jzbt70/llvmlite/ffi/build.py
LLVM version... 6.0.0
Traceback (most recent call last):
File "/tmp/pip-build-a4jzbt70/llvmlite/ffi/build.py", line 191, in <module>
main()
File "/tmp/pip-build-a4jzbt70/llvmlite/ffi/build.py", line 181, in main
main_posix('linux', '.so')
File "/tmp/pip-build-a4jzbt70/llvmlite/ffi/build.py", line 143, in main_posix
raise RuntimeError(msg)
RuntimeError: Building llvmlite requires LLVM 10.0.x or 9.0.x, got '6.0.0'. Be sure to set LLVM_CONFIG to the right executable path.
Read the documentation at http://llvmlite.pydata.org/ for more information about building llvmlite.
error: command '/media/Projects/outliers/.venv/bin/python3' failed with exit status 1
----------------------------------------
Failed building wheel for llvmlite
Running setup.py clean for llvmlite
Failed to build llvmlite
Installing collected packages: llvmlite
Running setup.py install for llvmlite ... error
Complete output from command /media/Projects/outliers/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-a4jzbt70/llvmlite/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-xelmdsmd-record/install-record.txt --single-version-externally-managed --compile --install-headers /media/Projects/outliers/.venv/include/site/python3.6/llvmlite:
running install
running build
got version from file /tmp/pip-build-a4jzbt70/llvmlite/llvmlite/_version.py {'version': '0.34.0', 'full': 'c5889c9e98c6b19d5d85ebdd982d64a03931f8e2'}
running build_ext
/media/Projects/outliers/.venv/bin/python3 /tmp/pip-build-a4jzbt70/llvmlite/ffi/build.py
LLVM version... 6.0.0
Traceback (most recent call last):
File "/tmp/pip-build-a4jzbt70/llvmlite/ffi/build.py", line 191, in <module>
main()
File "/tmp/pip-build-a4jzbt70/llvmlite/ffi/build.py", line 181, in main
main_posix('linux', '.so')
File "/tmp/pip-build-a4jzbt70/llvmlite/ffi/build.py", line 143, in main_posix
raise RuntimeError(msg)
RuntimeError: Building llvmlite requires LLVM 10.0.x or 9.0.x, got '6.0.0'. Be sure to set LLVM_CONFIG to the right executable path.
Read the documentation at http://llvmlite.pydata.org/ for more information about building llvmlite.
error: command '/media/Projects/outliers/.venv/bin/python3' failed with exit status 1
----------------------------------------
Command "/media/Projects/outliers/.venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-a4jzbt70/llvmlite/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-xelmdsmd-record/install-record.txt --single-version-externally-managed --compile --install-headers /media/Projects/outliers/.venv/include/site/python3.6/llvmlite" failed with error code 1 in /tmp/pip-build-a4jzbt70/llvmlite/
我认为最重要的一句话是:
RuntimeError: Building llvmlite requires LLVM 10.0.x or 9.0.x, got '6.0.0'. Be sure to set LLVM_CONFIG to the right executable path.
如果有人尝试更新它,它会说 6.X 是最新的:
user@desktop:~$ apt install llvm
Reading package lists... Done
Building dependency tree
Reading state information... Done
llvm is already the newest version (1:6.0-41~exp5~ubuntu1).
The following packages were automatically installed and are no longer required:
boinc-client golang-1.10-go golang-1.10-src golang-src libboinc7 libgsoap-2.8.60 libllvm10 libllvm10:i386 libnvidia-cfg1-440 libnvidia-common-435 libnvidia-common-440
libnvidia-compute-440 libnvidia-decode-440 libnvidia-ifr1-440 libvncserver1 linux-headers-4.15.0-106 linux-headers-4.15.0-106-generic linux-headers-4.15.0-115
linux-headers-4.15.0-115-generic linux-headers-5.4.0-45-generic linux-hwe-5.4-headers-5.4.0-45 python-fasteners python-monotonic python-pexpect python-ptyprocess
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.
我也尝试过1)使用他们的 apt deb 源(不起作用,添加后没有任何反应,使用时最新版本仍为 6.X apt upgrade
),2)下载他们的文件(没有提供如何安装的说明)。
答案1
点击此处了解如何安装 LLVMhttps://apt.llvm.org/像这样检索档案签名:
wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
添加要从中安装的 PPA:
add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
更新包:
sudo apt update
安装默认 llvm 和 llvm-config:
sudo apt install llvm
安装自定义版本:llvm-10 和 llvm-config-10:
sudo apt-get install llvm-10 lldb-10 llvm-10-dev libllvm10 llvm-10-runtime
使用“update-alternatives”为“llvm-config”配置如下替代方案:
sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-6.0 6
sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-10 10
sudo update-alternatives --config llvm-config
...并选择:“1”
选择 | 小路 | 优先事项 | 地位 |
---|---|---|---|
* 0 | /usr/bin/llvm-config-6.0 | 6 | 自动模式 0 |
1 | /usr/bin/llvm-config-10 | 10 | 自动模式 1 |
按 <enter> 键保留当前选择[*],或输入选择编号:1
答案2
我使用的是 Mint 19.3,但这也适用于 Ubuntu 18.04,该 Mint 版本就是基于 Ubuntu 18.04 的。
我的解决方案是在安装时指定要具体使用的版本:
sudo apt-get install llvm-10*
这里使用星号的原因是,一些相关的包也是需要的,所以仅仅安装基础包是行不通的(至少对于皮奥德当您尝试 pip install 时,它会为您提供llvm-config: error: component libraries and shared library
)。这是后续问题和解决方案被提及。
此后,您需要更改链接llvm-config
,否则它仍指向 6.X 版本。这是通过(从这里):
sudo -i
cd /usr/bin
rm llvm-config #if it exists already, which probably it does
ln -s llvm-config-10 llvm-config
配置现在指向正确的版本。安装 10 版本不会更新此指针。此后,我的pip
命令起作用了(即pip install llvmlite
,之后pip install pyod
)。
答案3
llvm.org 现在提供了一个安装脚本,用于安装最新的稳定版本。
bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
在我的系统(Bionic)上,我得到了一个包含文本的错误喷涌The following packages have unmet dependencies: libdb4.8++ : Depends: libgcc-s1 (>= 3.0) but it is not installable
,但按照这里的修复https://bitcoin.stackexchange.com/questions/98872/depends-libgcc-s1-3-0-but-it-is-not-installable-bitcoind-wallet-dependency并重新运行成功。