Search code examples
python-2.7pip

python 2.7 - pip install -> Errno 42


last week i had to reset my PC.
And today I'm trying to install some packages with python 2.7 (Don't ask why or tell me to upgrade cause i can't)

|ERROR: Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence

Any suggestion how to solve it?

I can add -q (and its work) but i have about 40 packages to install.
I Already check my environment variable, and everything seem OK.


Solution

  • I think you should install or export UTF first, So in your command window

    -- coding: utf-8 --

    like this and you can also use

    import sys /n reload(sys) /n sys.setdefaultencoding('utf-8')

    Note that setting the default encoding using sys.setdefaultencoding() is not recommended in Python 2.7, as it can have unintended side effects. It's better to explicitly encode/decode strings using the encode() and decode() methods, or use libraries like six that provide compatibility between Python 2 and 3.

    But you try both and later reach if any quarries. Thank you.