Python 2 is GBK and Python 3 is UTF-8. Some older packages can cause coding problems when installed.
Because PyCharm recently pops up RELP Communications all the time, it affects the efficiency of the code.
REPL (Read-Eval-Print Loop), which translates as “read-evaluation-output” Loop, is a simple, interactive programming environment.
Sounds useful, so I want to PIP the REPL directly in PyCharm.
Error result:
ERROR: Command errored out with exit status 1:
The main error is shown in the last few lines:
UnicodedecodeError: ‘GBK’ codec can’t decode byte 0xa6 in position 1246: illegal multibyte sequence
—————————————-
ror: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Positioning problems:
UnicodeDecodeError, indicating an encoding problem.
Specifically, on lines 10 and 17 of the setup.py file, the read file is encoded as GBK, not UTF-8, so the error prevents installation.
Update the successful solution:
Because you cannot use Project Interpreter in PyCharm.
Solution: download the source code package, make code changes and then install.
1. Locate the file of the original Package and find the line that reported the error.
REPL official address is: https://github.com/mbr/repl. View the source code of the setup file that reported the error.
Location problem: the source code does not specify the open encoding, so the default is GBK encoding.
Error source code:
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
2. After downloading the original package file, unpack it and find the setup.py file. Change this line in the file, add encoding=’utf-8′, save it and package it as a new installation package.
Modified code:
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname),encoding='utf-8').read()
3. Enter PIP install repl-1.0.tar.gz and install with the new package. Success!
This problem bothered me for a week, but it turned out that the solution was very simple!
The most important thing to solve the problem is to locate the cause of the error, and then find a solution step by step according to the reason.
Read More:
- On the problem of from PIL import image
- Java – read all the files and folders in a certain directory and three methods to get the file name from the file path
- Package python3.1 + PyQt4 into exe
- Solution of Unicode decodeerror -‘utf-8 ‘codec can’t decode byte 0xc4 in position 0 – invalid continuation byte
- Pychar error: Error:failed to find libmagic. Check your installation
- Pychar runtime error r6034 solution
- Solve Python error Unicode error ‘UTF-8’
- How to Fix Error in python3 | PIP install Dlib
- The problem of unable to install win32gui in building Anaconda environment in pychar
- PIP report failed to create process
- [Python] failed building wheel for MySQL Python solution
- Solve the problem of prompt couldn’t find path to unrear library after installing unrear in Python
- Mac install pycurl error: python setup.py egg_info" failed with error code 1”
- Data analysis to obtain Yahoo stock data: some problems are encountered when using panda datareader (cannot import name ‘is_ list_ Like ‘problem)
- fatal error: Python.h: No such file or directory
- Java prompt unmappable character for encoding solution
- Unable to call numpy in pychar, module notfounderror: no module named ‘numpy’
- command ‘x86_64-linux-gnu-gcc’ failed with exit status 1
- Error encountered while executing PIP install: error: complete output from command Python setup.py egg_ info:
- The solution to the error of importing CSV from Python to Python