pip install - locale.Error: unsupported locale setting

后端 未结 9 1137
时光取名叫无心
时光取名叫无心 2020-12-07 06:58

Full stacktrace:

➜  ~ pip install virtualenv
Traceback (most recent call last):
  File \"/usr/bin/pip\", line 11, in 
    sys.exit(main())
           


        
9条回答
  •  情歌与酒
    2020-12-07 07:19

    The root cause is: your environment variable LC_ALL is missing or invalid somehow

    Short answer-

    just run the following command:

    $ export LC_ALL=C
    

    If you keep getting the error in new terminal windows, add it at the bottom of your .bashrc file.

    Long answer-

    Here is my locale settings:

    $ locale
    LANG=en_US.UTF-8
    LANGUAGE=
    LC_CTYPE="C"
    LC_NUMERIC="C"
    LC_TIME="C"
    LC_COLLATE="C"
    LC_MONETARY="C"
    LC_MESSAGES="C"
    LC_PAPER="C"
    LC_NAME="C"
    LC_ADDRESS="C"
    LC_TELEPHONE="C"
    LC_MEASUREMENT="C"
    LC_IDENTIFICATION="C"
    LC_ALL=C
    

    Python2.7

        $ uname -a
        Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u6 (2015-11-09) x86_64 GNU/Linux
        $ python --version
        Python 2.7.9
        $ pip --version
        pip 8.1.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
        $ unset LC_ALL
        $ pip install virtualenv
        Traceback (most recent call last):
          File "/usr/local/bin/pip", line 11, in 
            sys.exit(main())
          File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 215, in main
            locale.setlocale(locale.LC_ALL, '')
          File "/usr/lib/python2.7/locale.py", line 579, in setlocale
            return _setlocale(category, locale)
        locale.Error: unsupported locale setting
        $ export LC_ALL=C
        $ pip install virtualenv
        Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/dist-packages
    

提交回复
热议问题