最近在pi4上面安裝conan (用pip install conan指令)之後,試著執行 conan --help看看,結果出現以下的訊息
pi@myPi4:~ $ conan --help
Traceback (most recent call last):
File "/home/pi/.local/bin/conan", line 6, in <module>
from conans.conan import run
File "/home/pi/.local/lib/python2.7/site-packages/conans/conan.py", line 7, in <module>
from conans.client.command import main
...
...
...
from conan.tools.cmake.toolchain.blocks import ToolchainBlocks, UserToolchain, GenericSystemBlock, \
File "/home/pi/.local/lib/python2.7/site-packages/conan/tools/cmake/toolchain/blocks.py", line 9, in <module>
from conan.tools.apple.apple import is_apple_os, to_apple_arch
File "/home/pi/.local/lib/python2.7/site-packages/conan/tools/apple/__init__.py", line 8, in <module>
from conan.tools.apple.apple import fix_apple_shared_install_name
File "/home/pi/.local/lib/python2.7/site-packages/conan/tools/apple/apple.py", line 170
command = f"install_name_tool {dylib_path} -id {new_name}"
^
SyntaxError: invalid syntax
-------------
這裡面完全沒有python3這樣的字樣,這表示安裝conan時它找錯python了
先以python --version check是否是真對應到python3
而不是預期的3.7.3
這時你需要指定順序才行
------
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
-------
這時你需要指定順序才行
------
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
-------
這樣,我們再使用python --verion就會出現預期的 python 3.x
一起加油吧
update : 2022/07/30
如果python2 沒安裝而直接安裝python3的,但「python --version 」出現command not found的訊息的話,那就要安裝「sudo apt install python-is-python3」了
ref: 這裡的第67則回覆
如果python2 沒安裝而直接安裝python3的,但「python --version 」出現command not found的訊息的話,那就要安裝「sudo apt install python-is-python3」了
ref: 這裡的第67則回覆
沒有留言:
張貼留言