Virtualenv创建错误

时间:2016-04-30 19:54:09

标签: linux virtualenv raspberry-pi2 bin

我正在RaspberryPi上创建一个新的虚拟环境。安装了所有必需的软件包,但是当我想创建一个虚拟环境时,它会抛出这样的错误。

$ virtualenv venv --system-site-packages
New python executable in /home/pi/venv/bin/python
Installing setuptools, pip, wheel...
  Complete output from command /home/pi/venv/bin/python - setuptools pip wheel:
  Traceback (most recent call last):
  File "<stdin>", line 23, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-8.1.1-py2.py3-none-any.whl/pip/__init__.py", line 215, in main
  File "/home/pi/venv/lib/python2.7/locale.py", line 579, 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/python2.7/dist-packages/virtualenv.py", line 708, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 941, in create_environment
    download=download,
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 897, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 792, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/pi/venv/bin/python - setuptools pip wheel failed with error code 1

此虚拟环境仍然创建,但当我导航到/ venv / bin时,唯一的文件是

~/venv/bin $ ls
python  python2  python2.7

这样

$ source bin/activate
-bash: bin/activate: No such file or directory

我很困惑请帮助&gt; _&lt;谢谢!

1 个答案:

答案 0 :(得分:1)

我有完全相同的问题。

我解决了这个问题

sudo apt-get install language-pack-id
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure locales

我尝试了很多东西,但只有这个解决了它,但我又是新的,所以我不确定我在做什么。希望这是解决它的原因,而不是这个我以前尝试过的300件事的组合。

从这里得到答案Python locale error: unsupported locale setting