harmony(鸿蒙)Fixing Compilation Issues

  • 2022-08-09
  • 浏览 (786)

Fixing Compilation Issues

What should I do if the message “ImportError: No module named apt_pkg” is displayed during the execution of an unidentifiable command?

  • Symptom

The message “ImportError: No module named apt_pkg” is displayed when an unidentifiable command is executed on the Linux server.

  • Possible Causes

There is a compatibility issue of python3-apt.

  • Solution

Reinstall python3-apt.

  sudo apt-get remove  python3-apt
  sudo apt-get install python3-apt

What should I do if the message indicating Python cannot be found is displayed during compilation and building?

  • Symptom

The following error occurs during compilation and building:

  -bash: /usr/bin/python: No such file or directory
  • Possible Cause 1

Python is not installed.

  • Solution

Run the following command to install Python. The following uses Python 3.8 as an example.

  sudo apt-get install python3.8
  • Possible Cause 2

The soft link that points to the Python does not exist in the usr/bin directory.

en-us_image_0000001226922322

  • Solution

Run the following commands to add a soft link:

  # cd /usr/bin/ 
  # which python3
  # ln -s /usr/local/bin/python3 python
  # python --version

Example:

en-us_image_0000001271562453

What should I do if the message indicating Python 3 cannot be found is displayed during the build process?

  • Symptom

en-us_image_0000001226602414

  • Possible Causes

Python 3 is not installed.

  • Solution

Run the following command to install Python 3:

  sudo apt-get install python3.8

What should I do if the message “configure: error: no acceptable C compiler found in $PATH” is displayed during Python 3 installation?

  • Symptom

The following error occurs during Python 3 installation:

  configure: error: no acceptable C compiler found in $PATH. See 'config.log' for more details
  • Possible Causes

gcc is not installed.

  • Solution

    1. Run the apt-get install gcc command to install gcc online.
    2. After the installation, reinstall Python 3.

What should I do if the message “-bash: make: command not found” is displayed during Python 3 installation?

  • Symptom

The following error occurs during Python 3 installation:

  -bash: make: command not found
  • Possible Causes

Make is not installed.

  • Solution

    1. Run the apt-get install make command to install Make online.
    2. After the installation, reinstall Python 3.

What should I do if the message “No module named ‘_ctypes’” is displayed during Python 3 installation?

  • Symptom

The following error occurs during Python 3 installation:

  ModuleNotFoundError: No module named '_ctypes'
  • Possible Causes

libffi and libffi-devel are not installed.

  • Solution

    1. Run the apt-get install libffi* -y command to install libffi and libffi-devel online.
    2. After the installation, reinstall Python 3.

What should I do if the message “No module named ‘Crypto’” is displayed during the build process?

  • Symptom

The following error occurs during compilation and building:

  ModuleNotFoundError: No module named 'Crypto'
  • Possible Causes

Crypto is not installed.

  • Solution

Solution 1: Run the pip3 install Crypto command to install Crypto online.

Method 2: Offline installation

Download the source code from PyPI.

en-us_image_0000001227082334

Save the source package to the Linux server, decompress the package, and run the python3 setup.py install command to install Crypto.

After the preceding installation is complete, rebuild an environment.

你可能感兴趣的鸿蒙文章

harmony(鸿蒙)Getting Started

harmony(鸿蒙)Overall Description of Compilation Form Factors

harmony(鸿蒙)Importing a Source Code Project

harmony(鸿蒙)Setting Up the Windows+Ubuntu Hybrid Development Environment

harmony(鸿蒙)Introduction to the Hi3516 Development Board

harmony(鸿蒙)Introduction to the Hi3861 Development Board

harmony(鸿蒙)Mini and Small System Overview

harmony(鸿蒙)Obtaining Source Code

harmony(鸿蒙)Building

harmony(鸿蒙)Burning

0  赞