基本指令

anaconda 中安装sklearn : conda install scikit-learn

查看安装的软件包及版本信息:pip list 或者 conda list

安装pip:

 wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate
tar -zxvf pip-1.5.4.tar.gz
cd pip-1.5.4/
python setup.py install

安装setup-tools

wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-12.0.3.tar.gz#md5=f07e4b0f4c1c9368fcd980d888b29a65
tar -zxvf setuptools-12.0.3.tar.gz
cd setuptools=12.0.3
python setup.py install

pip install numpy老出现问题:

Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('
', '
'), __file__, 'exec'))" install --record /tmp/pip-46lX1y-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/numpy
Storing debug log for failure in /root/.pip/pip.log

终于找到原因了。原因在于云主机1G内存,g++编译的时候内存不足了。通过建立临时交换分区来解决。

sudo dd if=/dev/zero of=/swapfile bs=64M count=16
sudo mkswap /swapfile
sudo swapon /swapfile

After compiling, you may wish to

Code:
sudo swapoff /swapfile
sudo rm /swapfile
原文地址:https://www.cnblogs.com/futurehau/p/6126596.html