I am facing the following error:
Warning: the environment variable LANG is not set! We recommend setting this in ~/.profile (or equivalent) for proper expected behavior. Creating a virtualenv for this project… Using /usr/local/opt/python/bin/python3.6 (3.6.4) to create virtualenv… ⠋Traceback (most recent call last): File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.6/site-packages/pipenv/pew/__main__.py", line 8, in <module> import pew File "/usr/local/lib/python3.6/site-packages/pipenv/patched/pew/__init__.py", line 1, in <module> from . import pew File "/usr/local/lib/python3.6/site-packages/pipenv/patched/pew/pew.py", line 41, in <module> from pew._utils import (check_call, invoke, expandpath, own, env_bin_dir, File "/usr/local/lib/python3.6/site-packages/pipenv/patched/pew/_utils.py", line 22, in <module> encoding = locale.getlocale()[1] or 'ascii' File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/locale.py", line 581, in getlocale return _parse_localename(localename) File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/locale.py", line 490, in _parse_localename raise ValueError('unknown locale: %s' % localename) ValueError: unknown locale: UTF-8
Virtualenv location:
Creating a Pipfile for this project… Traceback (most recent call last): File "/usr/local/bin/pipenv", line 11, in <module> sys.exit(cli()) File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/pipenv/cli.py", line 366, in install selective_upgrade=selective_upgrade, File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 1761, in do_install skip_requirements=skip_requirements, File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 636, in ensure_project ensure_pipfile(validate=validate, skip_requirements=skip_requirements) File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 289, in ensure_pipfile project.create_pipfile(python=python) File "/usr/local/lib/python3.6/site-packages/pipenv/project.py", line 518, in create_pipfile 'python_version': python_version(required_python)[: len('2.7')] TypeError: 'NoneType' object is not subscriptable
I tried setting the LANG
in ~/.profile
and ~/.bash_profile
. Both didn’t work.
Advertisement
Answer
What worked for me on Mac OS X Sierra is adding the following into my ~/.bash_profile
file:
export LANG="en_US.UTF-8" export LC_ALL="en_US.UTF-8" export LC_CTYPE="en_US.UTF-8"
Then I reloaded the bash profile with: source ~/.bash_profile
For those who use zsh shell, you must add those lines to your ~/.zshrc
export LANG="en_US.UTF-8" export LC_ALL="en_US.UTF-8" export LC_CTYPE="en_US.UTF-8"
Then I reload the bash profile with: source ~/.zshrc