The final solution for pip installation error on windows computer.

1. Question:

I don't know what's wrong today. I used pip to install various modules, and all reported errors, but there was no solution. There was no way. I uninstalled and installed several versions of pip, but it still didn't work.

Now this is the error of the last pip version. I have been working on it for too long. I found a way to install python installation and unzip package.

C:\>pip install httpheader
Collecting httpheader
  Using cached httpheader-1.1.tar.gz (30 kB)
ERROR: Exception:
Traceback (most recent call last):
  File "D:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\cli\base_command.py", line 216, in _main
    status = self.run(options, args)
  File "D:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\cli\req_command.py", line 182, in wrapper
    return func(self, options, args)
  File "D:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\commands\install.py", line 325, in run
    reqs, check_supported_wheels=not options.target_dir
  File "D:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 183, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "D:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 388, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "D:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 340, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
  File "D:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\operations\prepare.py", line 483, in prepare_linked_requirement
    req, self.req_tracker, self.finder, self.build_isolation,
  File "D:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\operations\prepare.py", line 91, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "D:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\distributions\sdist.py", line 40, in prepare_distribution_metadata
    self.req.prepare_metadata()
  File "D:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\req\req_install.py", line 554, in prepare_metadata
    self.metadata_directory = self._generate_metadata()
  File "D:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\req\req_install.py", line 534, in _generate_metadata
    details=self.name or "from {}".format(self.link)
  File "D:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\operations\build\metadata_legacy.py", line 73, in generate_metadata
    command_desc='python setup.py egg_info',
  File "D:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\utils\subprocess.py", line 200, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "D:\python_work_tools\python3.6.8\lib\codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 18: invalid continuation byte

Two, a few small points

Every time I look for it, it’s too much trouble. Let me write down how I uninstalled and installed pip today. You can also refer to it if necessary.

1. Windows uninstall pip

python -m pip uninstall pip

After uninstalling, I found that there were still residues in the Scripts directory under the python installation directory, so I decided to delete the test completely.

My installation directory D:\python_work_tools\python3.6.8\Scripts

Insert picture description here

2. Update pip

python -m pip install --upgrade pip

3. Install pip

Find the pip version you want to install:
the address I installed: https://pypi.org/project/pip/19.2/

Insert picture description here

The middle Release historyis so pip version, or you can choose.

Click Download filesDownload to download the module compression package of gz.
Insert picture description here
Then unzip. Enter the decompression directory.

Then cmd or powershell enters the unzipped directory,

 python setup.py install

Insert picture description here

3. Solve the installation problems of other modules:

I don't know, what happened to my company computer suddenly, I can't install the module suddenly today. Then according to the steps of installing pip above, I feel that other modules can be viewed, and the installation is successful.

I won’t take a screenshot for this step, just install other modules according to the pip installation steps above.
It feels like it won’t be good for a while, so let’s just install the module using the compressed package downloaded from gz.

Guess you like

Origin blog.csdn.net/weixin_42081389/article/details/108407347