【分享】Ubuntun 16.04系统,Python2和Python3不兼容,导致PetaLinux 2019.1 执行"petalinux-config", 失败。

作者:hankf,Xilinx Employee

Ubuntun 16.04系统,PetaLinux 2019.1 执行"petalinux-config", 失败。

1. PetaLinux 2019.1 执行"petalinux-config", 失败。

[INFO] generating meta-plnx-generated layer
File "genprop.py", line 40
print "\tINFO:"+conf+" not define in system config" ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("\tINFO:"+conf+" not define in system config")?
ERROR: Failed to generate meta-plnx-generated layer
ERROR: Failed to config project.
看起来像是Python2和Python3不兼容导致的问题。

2. 检查Python版本,发现生效的是Python 3.6.5。

$ python
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>>
KeyboardInterrupt
>>>

3. 检查Python位置,发现使用的anaconda3中的Python。

$ which python
/xilinxtool/anaconda3/bin/python

4. 检查PATH实际内容,其中包含了anaconda3的路径。

/xilinxtool/SDK/2019.1/bin:/xilinxtool/SDK/2019.1/gnu/microblaze/lin/bin:/xilinxtool/SDK/2019.1/gnu/arm/lin/bin:/xilinxtool/SDK/2019.1/gnu/microblaze/linux_toolchain/lin64_le/bin:/xilinxtool/SDK/2019.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin:/xilinxtool/SDK/2019.1/gnu/aarch32/lin/gcc-arm-none-eabi/bin:/xilinxtool/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin:/xilinxtool/SDK/2019.1/gnu/aarch64/lin/aarch64-none/bin:/xilinxtool/SDK/2019.1/gnu/armr5/lin/gcc-arm-none-eabi/bin:/xilinxtool/SDK/2019.1/tps/lnx64/cmake-3.3.2/bin:/xilinxtool/Vivado/2019.1/bin:/xilinxtool/DocNav:/xilinxtool/peta/2019.1/tools/xsct/petalinux/bin:/xilinxtool/peta/2019.1/tools/common/petalinux/bin:/xilinxtool/peta/2019.1/tools/xsct/bin:/xilinxtool/peta/2019.1/tools/xsct/gnu/microblaze/lin/bin:/xilinxtool/peta/2019.1/tools/xsct/gnu/armr5/lin/gcc-arm-none-eabi/bin:/xilinxtool/peta/2019.1/tools/xsct/gnu/aarch64/lin/aarch64-none/bin:/xilinxtool/peta/2019.1/tools/xsct/gnu/aarch32/lin/gcc-arm-none-eabi/bin:/home/hankf/bin:/home/hankf/.local/bin:/xilinxtool/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

5. 重新设置PATH,去掉anaconda3的路径。

PATH=/xilinxtool/SDK/2019.1/bin:/xilinxtool/SDK/2019.1/gnu/microblaze/lin/bin:/xilinxtool/SDK/2019.1/gnu/arm/lin/bin:/xilinxtool/SDK/2019.1/gnu/microblaze/linux_toolchain/lin64_le/bin:/xilinxtool/SDK/2019.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin:/xilinxtool/SDK/2019.1/gnu/aarch32/lin/gcc-arm-none-eabi/bin:/xilinxtool/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin:/xilinxtool/SDK/2019.1/gnu/aarch64/lin/aarch64-none/bin:/xilinxtool/SDK/2019.1/gnu/armr5/lin/gcc-arm-none-eabi/bin:/xilinxtool/SDK/2019.1/tps/lnx64/cmake-3.3.2/bin:/xilinxtool/Vivado/2019.1/bin:/xilinxtool/DocNav:/xilinxtool/peta/2019.1/tools/xsct/petalinux/bin:/xilinxtool/peta/2019.1/tools/common/petalinux/bin:/xilinxtool/peta/2019.1/tools/xsct/bin:/xilinxtool/peta/2019.1/tools/xsct/gnu/microblaze/lin/bin:/xilinxtool/peta/2019.1/tools/xsct/gnu/armr5/lin/gcc-arm-none-eabi/bin:/xilinxtool/peta/2019.1/tools/xsct/gnu/aarch64/lin/aarch64-none/bin:/xilinxtool/peta/2019.1/tools/xsct/gnu/aarch32/lin/gcc-arm-none-eabi/bin:/home/hankf/bin:/home/hankf/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

6. 再检查Python位置,变更为Ubuntun 16.04系统自带的Python。

$ which python
/usr/bin/python

7. 检查Python版本,变更为Python 2.7.12。

$ python
Python 2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

8. 重新执行"petalinux-config", 执行成功。

来源:赛灵思

最新文章

最新文章