Pycharm - 无法将pipenv添加为项目解释器

4

在项目解释器中添加pipenv会出现错误。请帮助在Pycharm上设置pipenv:

Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2018.5.18/libexec/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv==2018.5.18', 'console_scripts', 'pipenv')()
  File "/usr/local/Cellar/pipenv/2018.5.18/libexec/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.5.18/libexec/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 676, in main
    _verify_python3_env()
  File "/usr/local/Cellar/pipenv/2018.5.18/libexec/lib/python3.6/site-packages/pipenv/vendor/click/_unicodefun.py", line 118, in _verify_python3_env
    'for mitigation steps.' + extra)
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment.  Consult http://click.pocoo.org/python3/for mitigation steps.

This system lists a couple of UTF-8 supporting locales that
you can pick from.  The following suitable locales where
discovered: af_ZA.UTF-8, am_ET.UTF-8, be_BY.UTF-8, bg_BG.UTF-8, ca_ES.UTF-8, cs_CZ.UTF-8, da_DK.UTF-8, de_AT.UTF-8, de_CH.UTF-8, de_DE.UTF-8, el_GR.UTF-8, en_AU.UTF-8, en_CA.UTF-8, en_GB.UTF-8, en_IE.UTF-8, en_NZ.UTF-8, en_US.UTF-8, es_ES.UTF-8, et_EE.UTF-8, eu_ES.UTF-8, fi_FI.UTF-8, fr_BE.UTF-8, fr_CA.UTF-8, fr_CH.UTF-8, fr_FR.UTF-8, he_IL.UTF-8, hr_HR.UTF-8, hu_HU.UTF-8, hy_AM.UTF-8, is_IS.UTF-8, it_CH.UTF-8, it_IT.UTF-8, ja_JP.UTF-8, kk_KZ.UTF-8, ko_KR.UTF-8, lt_LT.UTF-8, nl_BE.UTF-8, nl_NL.UTF-8, no_NO.UTF-8, pl_PL.UTF-8, pt_BR.UTF-8, pt_PT.UTF-8, ro_RO.UTF-8, ru_RU.UTF-8, sk_SK.UTF-8, sl_SI.UTF-8, sr_YU.UTF-8, sv_SE.UTF-8, tr_TR.UTF-8, uk_UA.UTF-8, zh_CN.UTF-8, zh_HK.UTF-8, zh_TW.UTF-8

enter image description here enter image description here


你是否查阅了链接 - Bahrom
首先,访问错误信息中给出的URL。其次,从所列语言环境中选择一个。 - Code-Apprentice
我尝试了以下命令:'export LC_ALL=en_GB.UTF-8' 和 'export LANG=en_GB.UTF-8'。我在PyCharm终端中执行了这些命令,但仍然出现相同的错误。根据指南的建议,我从locale -a返回的值中选择了en_GB.UTF-8。 - zcahfg2
但是为什么这首先发生在PyCharm中,而不是其他地方呢? - zcahfg2
PyCharm设置中的文件编码 - 项目设置为系统默认值:UTF-8和全局编码UTF-8,那么为什么它要尝试使用ASCII? - zcahfg2
1
PyCharm的相关票据在其错误跟踪器中:https://youtrack.jetbrains.com/issue/PY-30780 - Pavel Karateev
2个回答

2
我的解决方案是将以下内容添加到~/.profile文件中。"最初的回答"。
export LC_ALL=es_ES.UTF-8
export LANG=es_ES.UTF-8

Note 注意,你应该将它添加到我提到的文件中,而不是.bashrc.zshrc,因为IDE很可能不会读取这些文件。

最初的回答:


1
在设置环境变量后,我可以通过终端启动Pycharm,就像这样:

export LC_ALL=es_ES.UTF-8 && export LANG=es_ES.UTF-8 && open -a PyCharm

设置完成后,您可以正常启动。

这是一种不好的方法。 - Julius Š.
@JuliusŠ. 你说得对,但那是我唯一的解决办法,不过自从最新版本发布后,这个问题似乎已经解决了。 - David Cifuentes
我终于发现应该将环境变量添加到 ~/.profile 中,这也解决了这个问题。 - Julius Š.

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接