SoFunction
Updated on 2024-10-29

Fixing pip execution errors caused by python upgrades

The default installation of python is version 2.6, I switched to version 3.5 today

We won't talk about upgrading your python version here.

After installing the new version, the previously installed plug-ins can not be used, and then use pip to install the prompt has been installed, but run the program is still in the import error.

Execute the upgrade command

python -m pip install -U pip

The upgrade was successful, but I still can't find the import plugin when I run the program.

So confirm the version with python -V.

It's true that python 3.5 is fine, so it should be a pip pointing problem

Look at pip under the /usr/local/bin directory:.

[root@dev1 bin]# ll /usr/local/bin |grep pip

Found 3 versions

[root@VM_9_69_centos test]# ll /usr/local/bin |grep pip
-rwxr-xr-x 1 root root 205 Jun 25 16:16 pip
-rwxr-xr-x 1 root root 205 Jun 25 16:16 pip3
-rwxr-xr-x 1 root root 205 Jun 25 16:16 pip3.5

Try running the install command with pip3.5:

pip3.5 install requests;

Installation was successful, run the program is no longer reported that it could not find the requests, so continue to use pip3.5 install the rest of the plug-ins, all installed successfully after the program is normal.

So, after installing the new python version, the

Check if the current python -V is a new version.

Then python -m pip install -U pip.

Check the current pip version: ll /usr/local/bin |grep pip

Finally, perform the installation operation with the new version.

The above article to solve the problem of pip execution error caused by python upgrade is all that I have shared with you.