pip cannot install piperclip: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83

Asked 2 years ago, Updated 2 years ago, 15 views

When I entered pip install pyperclip at the command prompt, I encountered the following error:

Exception:
Traceback (most recent call last):
  File "c:\program files\python36\lib\site-packages\pip\compat\_init__.py", line 73, in console_to_str
    returns.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 81: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\program files\python36\lib\site-packages\pip\basecommand.py", line 215, in main
    status=self.run(options,args)
  File "c:\program files\python36\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\program files\python36\lib\site-packages\pip\req\req_set.py", line 784, install
    **kwargs
  File "c:\program files\python36\lib\site-packages\pip\req\req_install.py", line 878, install
    spinner = spinner,
  File "c:\program files\python36\lib\site-packages\pip\utils\_init__.py", line 676, incall_subprocess
    line=console_to_str(proc.stdout.readline())
  File "c:\program files\python36\lib\site-packages\pip\compat\_init__.py", line 75, in console_to_str
    returns.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 81: invalid start byte    

I thought it was a character code-related error, so I used chcp at the command prompt to make it utf-8 and ran it, but eventually I couldn't install it.

python

2022-09-30 17:54

2 Answers

chcp65001 at the command prompt did not work.

The underlying problem is reported in https://github.com/pypa/pip/issues/4110 and will be fixed in the next pip-10.0:However, I think it would be a problem if I can't use it now, so I think I should use the development version until the release.

 python-mpip install-U https://github.com/pypa/pip/archive/master.zip

This installs pip-10.0.0.dev0.

I haven't seen a similar problem with my Windows environment (Win101709(16299.19) + Python-3.6.2(32bit) + pip-9.0.1), so I haven't been able to see if this will work, but it's worth a try.


2022-09-30 17:54

Now that I've solved myself, I'll write a review
First of all, I would like to thank the people who answered my question.
After a short sleep, I was thinking about it, and somehow I saw a problem.Now that I've solved myself, I'll write about the part that I think is the cause.

I was installing two pythons: python and anaconda in visual studio
I was suspicious, so I first uninstalled both
Reinstall anaconda
At the command prompt
python-V, pip-V, pip list
Run to check the version and pip list
pip 9.0.1, Python 3.6.3:: Anaconda, Inc. is fine.There seems to be no problem with the list.
And I successfully installed pip install pyperclip

Summary

The error contents cannot be pip-installed with UnicodeDecodeError.But
It might be strange if you installed both python and anaconda in visual studio like me.

Also, if you loop in your head and stop thinking, there might be a flash when you go to sleep and think about it again.

You may need to run pip.exe in C:\ProgramData\Anaconda3\Scripts.(I can't explain what's going on in doing this, but it's in the same directory.I don't think all pip lists will be installed)


2022-09-30 17:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.