我正在尝试使用XGBoost包,但在安装时遇到问题。我正在按照https://xgboost.readthedocs.io/en/latest/build.html#python-package-installation的安装指南进行操作。我已经成功地为OSX构建了xgboost,使用
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost; cp make/minimum.mk ./config.mk; make -j4
但是,当我尝试使用下面的代码在我的终端中安装python包时
cd python-package; sudo python setup.py install
我得到了错误python: command not found
。我不确定为什么会出现这个错误,因为我已经安装了python,并且可以运行ipython笔记本。Python安装在我电脑/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7
上。是否需要在我的bash_profile中添加路径才能访问它?我不明白为什么我不能从命令行使用python。
发布于 2017-08-10 15:49:28
我已经在这个question中回答了类似的问题。你可以像下面这样安装xgboost库和其他必需库(请根据你的项目所需的库进行选择),我在这个答案中的主要关注点是让它对大多数数据科学项目的设置有所帮助,这些项目需要sklearn、pandas、scipy和xgboost算法以及可视化库。
# installing essentials
apt-get update; \
apt-get install -y \
python python-pip \
build-essential \
python-dev \
python-setuptools \
python-matplotlib \
libatlas-dev \
curl \
libatlas3gf-base && \
apt-get clean
# upgrading pip
curl -O https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \
rm get-pip.py
# installing libraries
pip install numpy==1.13.1
pip install scipy
pip install -U scikit-learn
pip install seaborn
pip install --pre xgboost
如果你仍然有环境问题,我建议你使用这个Dockerfile。您可能还会发现Datmo转换对促进这一点很有用。
免责声明:我在一家名为Datmo的公司工作,该公司正在通过简化机器学习工作流程来建立一个开发人员社区。
发布于 2016-05-31 01:08:34
如果/usr/bin/
目录中有python
,则只需将该目录添加到path中即可。
将此行添加到您的.bash_profile
并重新启动您的shell。
export PATH="$PATH:/usr/bin"
然后,您应该能够使用/usr/bin
目录中的任何python版本。python
,python3
等。希望这能有所帮助。
https://stackoverflow.com/questions/37515599
复制相似问题