linux-setup.rst 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. *********************************************
  2. Linux 平台工具链的标准设置
  3. *********************************************
  4. :link_to_translation:`en:[English]`
  5. 安装准备
  6. =====================
  7. 编译 ESP-IDF 需要以下软件包:
  8. - CentOS 7::
  9. sudo yum -y update && sudo yum install git wget flex bison gperf python3 cmake ninja-build ccache dfu-util
  10. 目前仍然支持 CentOS 7,但为了更好的用户体验,建议使用 CentOS 8。
  11. - Ubuntu 和 Debian::
  12. sudo apt-get install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util
  13. - Arch::
  14. sudo pacman -S --needed gcc git make flex bison gperf python-pip cmake ninja ccache dfu-util
  15. .. 注解::
  16. 使用 ESP-IDF 需要 CMake 3.5 或以上版本。较早的 Linux 发行版可能需要升级自身的软件源仓库,或开启 backports 套件库,或安装 "cmake3" 软件包(不是安装 "cmake")。
  17. 其他提示
  18. ===============
  19. 权限问题 /dev/ttyUSB0
  20. ------------------------------------------------------------
  21. 使用某些 Linux 版本向 {IDF_TARGET_NAME} 烧录固件时,可能会出现 ``Failed to open port /dev/ttyUSB0`` 错误消息。此时可以将用户添加至 :ref:`Linux Dialout 组<linux-dialout-group>`。
  22. 设置 Python 3 为 CentOS 默认 Python 版本
  23. ----------------------------------------------------
  24. CentOS 7 及更早的版本提供 Python 2.7 作为默认解释器。但这里推荐使用 Python 3,您可以运行下方命令安装 Python 3。或者查看当前所用系统的相关文档,按照文档推荐的其它方法安装 Python 3::
  25. sudo yum -y update && sudo yum install python3 python3-pip python3-setuptools
  26. 设置 Python 3 为默认 Python 版本::
  27. sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && alias pip=pip3
  28. 设置 Python 3 为 Ubuntu 和 Debian 默认 Python 版本
  29. ----------------------------------------------------
  30. Ubuntu(v18.04 及之前的版本)和 Debian(v9 及之前的版本)的默认解释器为 Python 2.7,但这里推荐使用 Python 3,您可以运行下方命令安装 Python 3。或者查看当前所用系统的相关文档,按照文档推荐的其它方法安装 Python 3::
  31. sudo apt-get install python3 python3-pip python3-setuptools
  32. 设置 Python 3 为默认 Python 版本::
  33. sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && alias pip=pip3
  34. .. 注解::
  35. 上述设置为全局设置,同时会影响到其它应用。
  36. 修复 Ubuntu 16.04 损坏的 pip
  37. =================================
  38. ``python3-pip`` 包可能已损坏无法升级。需使用脚本 `get-pip.py <https://bootstrap.pypa.io/get-pip.py>`_ 手动删除并安装该包::
  39. apt remove python3-pip python3-virtualenv; rm -r ~/.local
  40. rm -r ~/.espressif/python_env && python get-pip.py
  41. 停用 Python 2
  42. ====================
  43. Python 2 已经 `结束生命周期 <https://www.python.org/doc/sunset-python-2/>`_,ESP-IDF 很快将不再支持 Python 2。请安装 Python 3.6 或以上版本。可参考上面列出的目前主流 Linux 发行版的安装说明。
  44. 后续步骤
  45. ==========
  46. 继续设置开发环境,请前往 :ref:`get-started-get-esp-idf` 章节。
  47. .. _AUR: https://wiki.archlinux.org/index.php/Arch_User_Repository