Sunday, 7 June 2020

python ImportError: cannot import name 'open_code' from 'io'

I faced python errors:

  1. First error:
    Fatal Python error: init_sys_streams: can't initialize sys standard streams
    Traceback (most recent call last):
      File "/home/user/miniconda3/envs/py38/lib/python3.8/io.py", line 54, in <module>
    ImportError: cannot import name 'open_code' from 'io' (unknown location)
    Aborted (core dumped)
    This error comes from the fact that there are two different versions of Python conflicting with each other.

  2. Second error:
tack Error: Command failed: E:\ProgramData\Anaconda3\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:303:12)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
gyp ERR! System Windows_NT 10.0.18363

This error because it required old version of python 2.7

To solve these errors we need to install multiple versions of python and switch between them

You can use this command to install python version
nvm install v6.11.4

You can use this command to list all python versions
nvm list

You can use this command to set default version
nvm use v6.11.4




No comments:

Post a Comment

Change docker images and containers location with Windows 10

Docker with windows has 2 mode windows and linux (wsl) For Windows Mode: Docker Configuration File: By default, Docker stores Images and ot...