pipenv install error UnicodeDecodeError: 'utf8' codec can't decode byte 0xb4 in position
環境
- win7
- python 2.7.14 32bit
問題
在使用 pipenv 初始化安裝過程時,遇到編碼問題,錯誤如下
λ pipenv install
Creating a virtualenv for this project...
Pipfile: F:\Code\AuotSystraceAnalysis\Pipfile
Using c:\python27\python.exe (None) to create virtualenv...
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pipenv.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\pipenv\vendor\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "c:\python27\lib\site-packages\pipenv\vendor\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\python27\lib\site-packages\pipenv\vendor\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\python27\lib\site-packages\pipenv\vendor\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python27\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\python27\lib\site-packages\pipenv\vendor\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "c:\python27\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\python27\lib\site-packages\pipenv\vendor\click\decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\python27\lib\site-packages\pipenv\cli\command.py", line 254, in install
editable_packages=state.installstate.editables,
File "c:\python27\lib\site-packages\pipenv\core.py", line 1741, in do_install
pypi_mirror=pypi_mirror,
File "c:\python27\lib\site-packages\pipenv\core.py", line 574, in ensure_project
pypi_mirror=pypi_mirror,
File "c:\python27\lib\site-packages\pipenv\core.py", line 506, in ensure_virtualenv
python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
File "c:\python27\lib\site-packages\pipenv\core.py", line 929, in do_create_virtualenv
combine_stderr=False, block=True, nospin=True, env=pip_config,
File "c:\python27\lib\site-packages\pipenv\vendor\vistir\misc.py", line 285, in run
_env = {fs_encode(k): fs_encode(v) for k, v in os.environ.items()}
File "c:\python27\lib\site-packages\pipenv\vendor\vistir\misc.py", line 285, in <dictcomp>
_env = {fs_encode(k): fs_encode(v) for k, v in os.environ.items()}
File "c:\python27\lib\site-packages\pipenv\vendor\vistir\misc.py", line 397, in to_bytes
return string.decode("utf-8").encode(encoding, errors)
File "c:\python27\lib\encodings\utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb4 in position 671: invalid start byte
分析
從錯誤內容看,是編碼方式問題,不確定是否中文問題影響,錯誤內容在
c:\python27\lib\site-packages\pipenv\vendor\vistir\misc.py
的397行,return string.decode("utf-8").encode(encoding, errors)
這句錯誤,也就是用 ‘utf-8’ 解碼方式報錯,這裡將其改為 “gbk” 嘗試 pass
File "c:\python27\lib\site-packages\pipenv\vendor\vistir\misc.py", line 397, in to_bytes
return string.decode("utf-8").encode(encoding, errors)
解決方法
將 c:\python27\lib\site-packages\pipenv\vendor\vistir\misc.py 檔案397 的 ‘utf-8’ 改為 ‘gbk’ 方式,Ok
pass
相關文章
- pip install 報錯UnicodeDecodeError: 'ascii' codec can't decode byteUnicodeErrorASCII
- Python報錯:UnicodeDecodeError: 'gbk' codec can't decode byte ...PythonUnicodeError
- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 0: invalid continuation byteUnicodeError
- pip install ... ERROR: UnicodeDecodeError: ‘gbk‘ codec can‘t decode/ python setup.py egg_info CheckErrorUnicodePython
- json.dumps錯誤:'utf8' codec can't decode byte解決方案JSON
- Python3.7使用pip install xxxx報錯:UnicodeDecodeError: 'gbk' codec can't decode bytePythonUnicodeError
- Python讀取檔案時出現UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position xx: 解決方案PythonUnicodeError
- PyMySQL 獲取資料 'utf-8' codec can't decode byte 0xed in position 2: 錯誤MySql
- tensorflow讀取圖片時出現錯誤UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid sUnicodeError
- PIP3安裝報錯nicodeDecodeError: 'ascii' codec can't decode byte 0xc3ErrorASCII
- python在用pandas對csv檔案處理的時候報UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xb6。。。的錯誤PythonUnicodeError
- Python——UnicodeEncodeError: 'ascii' codec can't encode/decode charactersPythonUnicodeErrorASCII
- Python3解決UnicodeEncodeError: 'ascii' codec can't encode characters in position 0PythonUnicodeErrorASCII
- 異常: 'ascii' codec can't encode charactersASCII
- Python讀取csv檔案出現解碼錯誤UnicodeDecodeError: ‘utf-8‘ codec can‘t decodPythonUnicodeError
- day1 UnicodeEncodeError: 'gbk' codec can't encode character '\xa0' in position 2490: illegal multi...UnicodeError
- [ERROR] Can't open the mysql.plugin tableErrorMySqlPlugin
- errors in crontab file, can't install. - linux crontabErrorLinux
- mysql [ERROR] Can't create IP socket: Permission deniedMySqlError
- ERROR in Entry module not found Error Can't resolve 'babel' in ' UseErrorBabel
- python cx_Oracle: UnicodeEncodeError: 'ascii' codec can't encode charactersPythonOracleUnicodeErrorASCII
- python報錯問題解決:'ascii' codec can't encode characterPythonASCII
- [筆記].痛哉!!!Error: Can't access JTAG chain, Error: Operation failed筆記ErrorAI
- Mysql報錯Fatal error:Can't open and lock privilege tablesMySqlError
- mysql can't connect error about privilege----not root userMySqlError
- ?Error: Can't locate /etc/centreon/conf.pm in @INC (@INError
- PostgreSQL/LightDB copy ERROR: invalid byte sequence for encoding "UTF8": 0x00SQLErrorEncoding
- ERROR 1135 (HY000): Can't create a new threadErrorthread
- Error:Can't connect to SOCKS proxy:Connection refused (Connection refused)Error
- MySQL 5.5 原始碼安裝報錯"[ERROR] Can't start server"MySql原始碼ErrorServer
- GTID複製報錯處理:Last_Error: Error 'Can't drop database 'test';ASTErrorDatabase
- easy_install 異常(zipimport.ZipImportError: can’t decompress data; zlib notImportError
- 【crontab】“bad minute”及“errors in crontab file, can't install”錯誤處理Error
- Fatal error: can't check configuration file '/home/watt/proxy/dError
- Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist解決辦法ErrorMySql
- Can't find the 'libpq-fe.h header when trying to install pg gemHeader
- 完美解決stack Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.ErrorPython
- MySQL案例-不同尋常的[ERROR]Can't create a new thread (errno 11)MySqlErrorthread