最近安装xgboost是报错如下 ERROR: Command errored out with exit status 1: command: ‘C:\Users\Administrator.conda\envs\py36\python.exe’ -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-iw8dkbrz\xgboost\setup.py’"’"’; file=’"’"‘C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-iw8dkbrz\xgboost\setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ egg_info --egg-base ‘C:\Users\ADMINI~1\AppData\Local\Temp\pip-pip-egg-info-a6el36bg’ cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-iw8dkbrz\xgboost Complete output (6 lines): Traceback (most recent call last): File “”, line 1, in File “C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-iw8dkbrz\xgboost\setup.py”, line 13 print output ^ SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(output)? ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
看到换色标记说print语法错误,有想到自己装的是python3,想到应该是xgboost的版本过低的问题,于是先更新pip,用pip install --upgrade pip,再使用pip install xgboost 安装成功没问题。