OSError:locale.Error - 不支持的区域设置

时间:2016-04-30 14:47:34

标签: python ubuntu pip locale virtualenv

我安装了pip3,python-dev和nginx。

接下来我用pip3安装了virtualenv。

我想制作virtualenv,但是当我输入以下命令时:

virtualenv project_juda

出现下一个错误:

juldou@ubuntu512mbfra1-01improveyourself:~/MyApp$virtualenv project_juda
Using base prefix '/usr'
New python executable in /home/juldou/MyApp/project_juda/bin/python3
Not overwriting existing python script /home/juldou/MyApp/project_juda/bin/python (you must use /home/juldou/MyApp/project_juda/bin/python3)
Installing setuptools, pip, wheel...
  Complete output from command /home/juldou/MyApp/project_juda/bin/python3 - setuptools pip wheel:
  Traceback (most recent call last):
  File "<stdin>", line 23, in <module>
  File "/usr/local/lib/python3.4/dist-packages/virtualenv_support/pip-8.1.1-py2.py3-none-any.whl/pip/__init__.py", line 215, in main
  File "/home/juldou/MyApp/project_juda/lib/python3.4/locale.py", line 592, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.4/dist-packages/virtualenv.py", line 708, in main
    symlink=options.symlink)
  File "/usr/local/lib/python3.4/dist-packages/virtualenv.py", line 941, in create_environment
    download=download,
  File "/usr/local/lib/python3.4/dist-packages/virtualenv.py", line 897, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/local/lib/python3.4/dist-packages/virtualenv.py", line 792, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/juldou/MyApp/project_juda/bin/python3 - setuptools pip wheel failed with error code 1

我不知道为什么。问题出在哪儿?

更新: 语言环境的输出:

juldou@ubuntu-512mb-fra1-01-improveyourself:~/MyApp$ locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=sk_SK.UTF-8
LC_TIME=sk_SK.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=sk_SK.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=sk_SK.UTF-8
LC_NAME=sk_SK.UTF-8
LC_ADDRESS=sk_SK.UTF-8
LC_TELEPHONE=sk_SK.UTF-8
LC_MEASUREMENT=sk_SK.UTF-8
LC_IDENTIFICATION=sk_SK.UTF-8
LC_ALL=

1 个答案:

答案 0 :(得分:3)

我在ubuntuforums找到了以下解决方案:

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
sudo dpkg-reconfigure locale

它对我有用!