当我做source activate my_env
时,会出现此错误:
λ source activate py36
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "C:\Miniconda3\lib\site-packages\conda\cli\main.py", line 98, in main
return activator_main()
File "C:\Miniconda3\lib\site-packages\conda\activate.py", line 632, in
main
print(activator.execute(), end='')
File "C:\Miniconda3\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u03bb' in
position 133: character maps to <undefined>
`$ C:\Miniconda3\Scripts\conda shell.posix activate py36`
environment variables:
ACLOCAL_PATH=C:\Program Files\Git\mingw64\share\aclocal;C:\Program
Files\Git\usr\share\aclocal
CIO_TEST=<not set>
CONDA_ROOT=C:\Miniconda3
CONDA_SHLVL=0
EXEPATH=C:\Program Files\Git\bin
HOMEPATH=\Users\patel_223gv41
INFOPATH=C:\Program Files\Git\usr\local\info;C:\Program
Files\Git\usr\share\info;C:\Program Files\Git\usr\info;C:\Program
Files\Git\share\info
MANPATH=C:\Program Files\Git\mingw64\local\man;C:\Program
Files\Git\mingw64\share\man;C:\Program
Files\Git\usr\local\man;C:\Program Files\Git\usr\share\man;C:\Program
Files\Git\usr\man;C:\Program Files\Git\share\man
ORIGINAL_PATH=C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users
\patel_223gv41\bin;C:\Yash\Cmder\vendor\conemu-
maximus5\ConEmu\Scripts;C:\Yash\Cmder\vendor\conemu-
maximus5;C:\Yash\Cmder\vendor\conemu-maximus5\ConEmu;C:\Miniconda3;C:\
Miniconda3\Library\mingw-w64\bin;C:\Miniconda3\Library\usr\bin;C:\Mini
conda3\Library\bin;C:\Miniconda3\Scripts;C:\Program Files
(x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\
system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\Windo
wsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program
Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program
Files\Intel\Intel(R) Management Engine
Components\IPT;C:\ProgramData\chocolatey\bin;C:\Program
Files\nodejs;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common
Files\Intel\WirelessCommon;C:\Program
Files\Java\jdk-10.0.2\bin;C:\Program Files\Git\cmd;C:\Users\patel_223g
v41\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS
Code\bin;C:\Yash\Cmder;C:\Users\patel_223gv41\AppData\Local\Microsoft\
WindowsApps;C:\Users\patel_223gv41\AppData\Roaming\npm;C:\Users\patel_
223gv41\AppData\Local\hyper\app-2.0.0\resources\bin;C:\Program Files\J
ava\jdk-10.0.2\bin;C:\Users\patel_223gv41\AppData\Local\Programs\Micro
soft VS Code\bin;C:\Users\patel_223gv41
PATH=C:\Users\patel_223gv41\bin;C:\Program Files\Git\mingw64\bin;C:\Program
Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program
Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Gi
t\usr\bin;C:\Users\patel_223gv41\bin;C:\Yash\Cmder\vendor\conemu-
maximus5\ConEmu\Scripts;C:\Yash\Cmder\vendor\conemu-
maximus5;C:\Yash\Cmder\vendor\conemu-maximus5\ConEmu;C:\Miniconda3;C:\
Miniconda3\Library\mingw-w64\bin;C:\Miniconda3\Library\usr\bin;C:\Mini
conda3\Library\bin;C:\Miniconda3\Scripts;C:\Program Files
(x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\
system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\Windo
wsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program
Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program
Files\Intel\Intel(R) Management Engine
Components\IPT;C:\ProgramData\chocolatey\bin;C:\Program
Files\nodejs;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common
Files\Intel\WirelessCommon;C:\Program
Files\Java\jdk-10.0.2\bin;C:\Program Files\Git\cmd;C:\Users\patel_223g
v41\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS
Code\bin;C:\Yash\Cmder;C:\Users\patel_223gv41\AppData\Local\Microsoft\
WindowsApps;C:\Users\patel_223gv41\AppData\Roaming\npm;C:\Users\patel_
223gv41\AppData\Local\hyper\app-2.0.0\resources\bin;C:\Program Files\J
ava\jdk-10.0.2\bin;C:\Users\patel_223gv41\AppData\Local\Programs\Micro
soft VS Code\bin;C:\Users\patel_223gv41;C:\Program
Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
PKG_CONFIG_PATH=C:\Program Files\Git\mingw64\lib\pkgconfig;C:\Program
Files\Git\mingw64\share\pkgconfig
PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\Windows
PowerShell\v1.0\Modules
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>
active environment : None
shell level : 0
user config file : C:\Users\patel_223gv41\.condarc
populated config files : C:\Users\patel_223gv41\.condarc
conda version : 4.5.11
conda-build version : not installed
python version : 3.7.1.final.0
base environment : C:\Miniconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : C:\Miniconda3\pkgs
C:\Users\patel_223gv41\AppData\Local\conda\conda\pkgs
envs directories : C:\Miniconda3\envs
C:\Users\patel_223gv41\AppData\Local\conda\conda\envs
C:\Users\patel_223gv41\.conda\envs
platform : win-64
user-agent : conda/4.5.11 requests/2.20.1 CPython/3.7.1 Windows/10 Windows/10.0.17134
administrator : False
netrc file : None
offline mode : False
An unexpected error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
[y/N]:
你们能帮帮我吗?我只希望能够从Git Bash激活conda环境。
此外,activate my_env
仅在使用常规命令提示符时有效,因此Git Bash和conda似乎存在问题。
如果需要,这是我的conda信息:
λ conda info
active environment : None
shell level : 0
user config file : C:\Users\patel_223gv41\.condarc
populated config files :
conda version : 4.5.11
conda-build version : not installed
python version : 3.7.0.final.0
base environment : C:\Miniconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/win-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/pro/win-64
https://repo.anaconda.com/pkgs/pro/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Miniconda3\pkgs
C:\Users\patel_223gv41\AppData\Local\conda\conda\pkgs
envs directories : C:\Miniconda3\envs
C:\Users\patel_223gv41\AppData\Local\conda\conda\envs
C:\Users\patel_223gv41\.conda\envs
platform : win-64
user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Windows/10 Windows/10.0.17134
administrator : False
netrc file : None
offline mode : False
编辑::似乎conda激活脚本通过我的bash提示进行扫描,并停留在lambda“λ”上,因为它无法识别此字符。
如果您阅读错误消息,我认为此特定部分非常突出:UnicodeEncodeError: 'charmap' codec can't encode character '\u03bb'
\u03bb
是lambda字符的unicode编码,但是激活脚本无法识别它。有什么方法可以更改编码,以便conda激活脚本可以识别此字符吗?
答案 0 :(得分:2)
您似乎处在Cmder session中,这意味着issue 7445可能适用:
请注意,cmder在每个命令前都有一个lambda字符(
λ
)。我认为是lambda charater (i.e. '\u03bb')在
\lib\encodings\cp1252.py
中找到的编码器/解码器类中未正确处理。
解决方法:
在第36行的
cmder\vendor\git-for-windows\etc\profile.d\git-prompt.sh
中删除lambda字符。PS1="$PS1"'' # prompt: always "λ "
答案 1 :(得分:0)
试试看。将lambda符号替换为“ >>”。您将需要在“ YOURPATHTOCMDER \ cmder \ vendor \ clink.lua”中找到文件,并更改函数 function set_prompt_filter(),如下所示:
function set_prompt_filter()
-- orig: $E[1;32;40m$P$S{git}{hg}$S$_$E[1;30;40m{lamb}$S$E[0m
-- color codes: "\x1b[1;37;40m"
cwd = clink.get_cwd()
prompt = "\x1b[1;32;40m{cwd} {git}{hg} \n\x1b[1;30;40m{lamb} \x1b[0m"
new_value = string.gsub(prompt, "{cwd}", cwd)
clink.prompt.value = string.gsub(new_value, "{lamb}", ">>")
结束