Yaml Install ERROR: Cannot uninstall ‘PyYAML’.

Error: cannot install pyyaml.

Article Directory:

1.Error cause analysis II. Final error solution

1.Error analysis

1. Start installing
I started installing yaml </ code>, using the following command:

pip install yaml

It is installed correctly and can be imported correctly from the command line, and then an error is reported when executing the program: attributeerror: module 'yaml' has no attribute 'fullloader' </ code> then I checked the version of yaml I installed:

pip show yaml   # show is version 3.12, which is too old

2. Error exploration1
check the tutorial online and say that you want to update the yaml version to 5.2 . The update method is as follows:

pip install -U PyYAML

In the process of updating, an error was reported:

ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

And then continue to find out how to solve this problem. Most of the solutions given are: delete all the yaml files under site packages , and guess what, LZ has been deleted completely. As a result, it is still this by when installing. Are you angry or not!

3. Error exploration 2

But I had to go to pypi website to download the wheel, and then install it directly

PyYAML-5.2-cp27-cp27m-win_ amd64.whlPyYAML-5.2-cp27-cp27m-win32.whl

Then install the wheels directly:

pip install PyYAML-5.2-cp27-cp27m-win_amd64.whl
# Then it said the platform is not supported, I looked at the amd may not be supported, so I tried again 32

pip install PyYAML-5.2-cp27-cp27m-win32.whl
# Again, the platform is not supported, I'm speechless

it seems that exploration is a failure. Let's find another way!

2、 Final error resolution

Use the following installation method to solve the problem:

# it worked
pip install --ignore-installed PyYAML

Another one, I don’t test it. You can try it

pip install  --force-reinstall PyYAML

or

pip install docker-py --ignore-installed PyYAML

Reference:
1 https://github.com/pypa/pip/issues/5247
2、 https://stackoverflow.com/questions/49911550/how-to-upgrade-disutils-package-pyyaml

Read More: