Help Center/ Atlas 300 Application (Model 3000)/ DDK Installation Guide (CentOS, ARM)/ FAQs/ What Do I Do If the Message "Import Error:cannot import name main" Is Displayed When the pip3/pip3.5 -V Command Is Run after pip3/pip3.5 Upgrade?
Updated on 2022-03-13 GMT+08:00

What Do I Do If the Message "Import Error:cannot import name main" Is Displayed When the pip3/pip3.5 -V Command Is Run after pip3/pip3.5 Upgrade?

Symptom

After pip3/pip3.5 upgrade, the Python library functions are changed. Therefore, the "Import Error:cannot import name main" error occurs upon a pip3/pip3.5 command.

Solution 1

Run the following upgrade command:

  • For Python 3:
    python3 -m pip install --upgrade pip --user
  • For Python 3.5:
    python3.5 -m pip install --upgrade pip --user

If the fault persists, follow Solution 2.

Solution 2

For Python 3:

Open vim /usr/bin/pip3.

Modify the code as shown in Figure 1.

Figure 1 Modifying pip3 code

The solution for Python 3.5 is the same as that for Python 3.