在centos6.X上安装caffe

0.编译安装gcc4.8.5

由于centos6.x中的gcc版本老旧,不支持c++11所以要安装gcc4.8.5,以下是安装教程。参考CentOS 6.4 编译安装 gcc-4.8.0

解压安装包进入目录执行download_prerequisites脚本./contrib/download_prerequisites

新建buildmkdir build

进入build目录执行

  1. ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib(生成Makefile文件)

修改Makefile文件中prefix=安装路径,这里的安装路径是/home/guanjun/caffe_lib/third/gcc-4.8.5

注意本文以下的安装路径都是/home/guanjun/caffe_lib/third下的对应目录

  1. make -j32
  2. make install

安装完成后要将gcc4.8.5中bin目录添加到环境变量(临时创建env_caffe.sh)

在env_caffe.sh中添加

  1. export PATH=/home/guanjun/caffe_lib/third/gcc-4.8.5/bin:$PATH

1.安装Anaconda python 环境

执行安装文件

./Anaconda2-4.2.0-Linux-x86_64.sh

注意在提示的最后的选项选no即不添加到.bashrc

之后同样在env_caffe.sh中添加export PATH=/home/guanjun/anaconda2/bin:$PATH

之后执行下面的命令

source ~/env_caffe.sh

因为编译boost时会用到python环境

2.编译安装boost

解压安装包然后执行

  1. ./bootstrap.sh
  2. ./b2 install --prefix=安装路径

参考boost Installation

3.编译安装opencv

解压安装包然后进入安装包执行

  1. mkdir build
  2. cd build
  3. ccmake ../

按照提示加载配置文件(按c)、修改cmake_install_prefix路径为安装路径、

WITH CUDA WITH CUFFT WITH JASPER分别设置为off,按照提示保存退出(按c 按g),然后执行

  1. make -j32
  2. make install

4.编译安装glog

解压然后依次执行

  1. ./configure --prefix=安装路径
  2. make -j32
  3. make intstall

5.编译安装gflags

解压然后进入解压文件依次执行

  1. mkdir build
  2. cd build
  3. export CXXFLAGS="-fPIC"
  4. ccmake ../

按c加载配置文件、设置安装路径按c g退出,之后执行

  1. make -j32
  2. make install

6.编译安装lmdb

首先下载lmdb安装包执行git clone https://github.com/LMDB/lmdb

打开lmdb中MakeFile文件、修改安装路径

  1. make -j
  2. make install

7.安装openblas

下载新版OpenBLASgit clone https://github.com/xianyi/OpenBLAS

进入OpenBLAS打开目录中cpuid.h文件在倒数第二行添加#define NO_AVX2 1024然后执行

  1. make -j32
  2. make install PREFIX=安装路径

8.编译安装hdf5

解压、进入文件执行

  1. ./configure --prefix=安装路径
  2. make -j32
  3. make install

9.编译安装protobuf

解压、进入文件执行

  1. ./configure --prefix=安装路径
  2. make -j32
  3. make install

之后将protobuf添加到环境变量中(env_caffe.sh)export PATH=/home/guanjun/caffe_lib/third/protobuf/bin:$PATH

在编译caffe前确保env_caffe.sh文件如下

  1. export PATH=/home/guanjun/caffe_lib/third/gcc-4.8.5/bin:/home/guanjun/anaconda2/bin:/home/guanjun/caffe_lib/third/protobuf/bin:$PATH
  2. export PYTHONPATH=/home/guanjun/caffe/py-R-FCN/caffe/python:$PYTHONPATH
  3. export LD_LIBRARY_PATH=/home/guanjun/caffe_lib/third_source/leveldb/out-shared:/home/guanjun/anaconda2/lib:/usr/local/cuda/lib64:/home/guanjun/caffe_lib/third/boost/lib:/home/guanjun/caffe_lib/third/hdf5/lib:/home/guanjun/caffe_lib/third/lmdb/lib:/home/guanjun/caffe_lib/third/openblas_v1/lib:/home/guanjun/caffe_lib/third/opencv/lib:/home/guanjun/caffe_lib/third/protobuf/lib:/home/guanjun/caffe_lib/third/glog/lib:/home/guanjun/caffe_lib/third/gflags/lib:/home/guanjun/caffe_lib/third/glibc-2.14/lib:/home/guanjun/caffe_lib/third/gcc-4.8.5/lib64:$LD_LIBRARY_PATH

/home/guanjun/替换成/home/你的用户名/

同时,保证caffe中的Makefile.config和下面的配置文件一样

  1. # Refer to http://caffe.berkeleyvision.org/installation.html
  2. # Contributions simplifying and improving our build system are welcome!
  3. # cuDNN acceleration switch (uncomment to build with cuDNN).
  4. USE_CUDNN := 1
  5. D_PATH := /home/guanjun/caffe_lib/third
  6. # CPU-only switch (uncomment to build without GPU support).
  7. #CPU_ONLY := 1
  8. # uncomment to disable IO dependencies and corresponding data layers
  9. # USE_OPENCV := 0
  10. USE_LEVELDB := 0
  11. # USE_LMDB := 0
  12. # uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
  13. # You should not set this flag if you will be reading LMDBs with any
  14. # possibility of simultaneous read and write
  15. # ALLOW_LMDB_NOLOCK := 1
  16. # Uncomment if you're using OpenCV 3
  17. # OPENCV_VERSION := 3
  18. # To customize your choice of compiler, uncomment and set the following.
  19. # N.B. the default for Linux is g++ and the default for OSX is clang++
  20. # CUSTOM_CXX := g++
  21. # CUDA directory contains bin/ and lib/ directories that we need.
  22. CUDA_DIR := /usr/local/cuda
  23. # On Ubuntu 14.04, if cuda tools are installed via
  24. # "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
  25. # CUDA_DIR := /usr
  26. # CUDA architecture setting: going with all of them.
  27. # For CUDA < 6.0, comment the *_50 lines for compatibility.
  28. #CUDA_ARCH := -gencode arch=compute_20,code=sm_20
  29. # -gencode arch=compute_20,code=sm_21
  30. CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \
  31. -gencode arch=compute_35,code=sm_35 \
  32. -gencode arch=compute_50,code=sm_50 \
  33. -gencode arch=compute_50,code=compute_50
  34. # BLAS choice:
  35. # atlas for ATLAS (default)
  36. # mkl for MKL
  37. # open for OpenBlas
  38. # BLAS := atlas
  39. BLAS := open
  40. # Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
  41. # Leave commented to accept the defaults for your choice of BLAS
  42. # (which should work)!
  43. BLAS_INCLUDE := /home/guanjun/caffe_lib/third/openblas_v1/include
  44. BLAS_LIB := /home/guanjun/caffe_lib/third/openblas_v1/lib
  45. # Homebrew puts openblas in a directory that is not on the standard search path
  46. # BLAS_INCLUDE := $(shell brew --prefix openblas)/include
  47. # BLAS_LIB := $(shell brew --prefix openblas)/lib
  48. # This is required only if you will compile the matlab interface.
  49. # MATLAB directory should contain the mex binary in /bin.
  50. # MATLAB_DIR := /usr/local
  51. # MATLAB_DIR := /Applications/MATLAB_R2012b.app
  52. # NOTE: this is required only if you will compile the python interface.
  53. # We need to be able to find Python.h and numpy/arrayobject.h.
  54. #PYTHON_INCLUDE := /usr/include/python2.7 \
  55. /usr/lib/python2.7/dist-packages/numpy/core/include
  56. # Anaconda Python distribution is quite popular. Include path:
  57. # Verify anaconda location, sometimes it's in root.
  58. ANACONDA_HOME := /home/guanjun/anaconda2
  59. PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
  60. $(ANACONDA_HOME)/include/python2.7 \
  61. $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \
  62. # Uncomment to use Python 3 (default is Python 2)
  63. # PYTHON_LIBRARIES := boost_python3 python3.5m
  64. # PYTHON_INCLUDE := /usr/include/python3.5m \
  65. # /usr/lib/python3.5/dist-packages/numpy/core/include
  66. # We need to be able to find libpythonX.X.so or .dylib.
  67. #PYTHON_LIB := /usr/lib
  68. PYTHON_LIB := $(ANACONDA_HOME)/lib
  69. # Homebrew installs numpy in a non standard path (keg only)
  70. # PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include
  71. # PYTHON_LIB += $(shell brew --prefix numpy)/lib
  72. # Uncomment to support layers written in Python (will link against Python libs)
  73. WITH_PYTHON_LAYER := 1
  74. # Whatever else you find you need goes here.
  75. INCLUDE_DIRS := $(D_PATH)/protobuf/include
  76. #INCLUDE_DIRS := /data/shiyang/anaconda2/include
  77. INCLUDE_DIRS += $(D_PATH)/hdf5/include
  78. INCLUDE_DIRS += $(D_PATH)/gflags/include
  79. INCLUDE_DIRS += $(D_PATH)/glog/include
  80. INCLUDE_DIRS += $(D_PATH)/opencv/include
  81. INCLUDE_DIRS += $(D_PATH)/boost/include
  82. INCLUDE_DIRS += $(D_PATH)/lmdb/include
  83. INCLUDE_DIRS += $(D_PATH)/glibc-2.14/include
  84. INCLUDE_DIRS += $(D_PATH)/gcc-4.8.5/include
  85. INCLUDE_DIRS += /home/guanjun/caffe_lib/third_source/leveldb/include
  86. LIBRARY_DIRS := $(D_PATH)/protobuf/lib
  87. #LIBRARY_DIRS := /data/shiyang/anaconda2/lib
  88. LIBRARY_DIRS += $(D_PATH)/hdf5/lib
  89. LIBRARY_DIRS += $(D_PATH)/gflags/lib
  90. LIBRARY_DIRS += $(D_PATH)/glog/lib
  91. LIBRARY_DIRS += $(D_PATH)/opencv/lib
  92. LIBRARY_DIRS += $(D_PATH)/boost/lib
  93. LIBRARY_DIRS += $(D_PATH)/lmdb/lib
  94. LIBRARY_DIRS += $(D_PATH)/glibc-2.14/lib
  95. LIBRARY_DIRS += $(D_PATH)/gcc-4.8.5/lib64
  96. LIBRARY_DIRS += /home/guanjun/caffe_lib/third_source/leveldb/out-shared
  97. INCLUDE_DIRS += $(PYTHON_INCLUDE) /usr/local/include
  98. LIBRARY_DIRS += $(PYTHON_LIB) /usr/local/lib /usr/lib
  99. # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
  100. # INCLUDE_DIRS += $(shell brew --prefix)/include
  101. # LIBRARY_DIRS += $(shell brew --prefix)/lib
  102. # Uncomment to use `pkg-config` to specify OpenCV library paths.
  103. # (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
  104. # USE_PKG_CONFIG := 1
  105. # N.B. both build and distribute dirs are cleared on `make clean`
  106. BUILD_DIR := build
  107. DISTRIBUTE_DIR := distribute
  108. # Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
  109. #DEBUG := 1
  110. # The ID of the GPU that 'make runtest' will use to run unit tests.
  111. TEST_GPUID := 0
  112. # enable pretty build (comment to see full commands)
  113. #Q ?= @

之后执行source ~/env_caffe.sh

进入caffe目录执行

  1. make -j32
  2. make runtest
  3. make pycaffe

将caffe的python添加到环境变量export PYTHONPATH=/home/guanjun/caffe/py-R-FCN/caffe/python:$PYTHONPATH就是env_caffe.sh中的第二行。

新建一个python文件测试import caffe是否可用。


在本地Ubuntu16.04上安装caffe

1.安装cuda

先把错配的显卡驱动清理干净

sudo apt-get --purge remove nvidia-*

https://developer.nvidia.com/cuda-downloads下载对应的deb文件(cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb)

到deb的下载目录下

  1. sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb
  2. sudo apt-get update
  3. sudo apt-get install cuda
  4. sudo reboot

参考ubuntu 14.04 现在安装cuda7.5超级简便,惊了

2.安装caffe

安装依赖

  1. sudo apt-get install -y opencl-headers build-essential protobuf-compiler \
  2. libprotoc-dev libboost-all-dev libleveldb-dev hdf5-tools libhdf5-serial-dev \
  3. libopencv-core-dev libopencv-highgui-dev libsnappy-dev \
  4. libatlas-base-dev cmake libstdc++6-4.8-dbg libgoogle-glog0v5 libgoogle-glog-dev \
  5. libgflags-dev liblmdb-dev git python-pip gfortran libopencv-dev
  6. sudo apt-get clean

下载caffe并安装caffe python依赖

  1. git clone https://github.com/BVLC/caffe.git
  2. cd caffe
  3. cd python
  4. for req in $(cat requirements.txt); do sudo pip install $req; done

准备Makefile.config,以便它可以ubuntu上构建

  1. cd ../
  2. cp Makefile.config.example Makefile.config

修改Makefile.config如下

  1. ## Refer to http://caffe.berkeleyvision.org/installation.html
  2. # Contributions simplifying and improving our build system are welcome!
  3. # cuDNN acceleration switch (uncomment to build with cuDNN).
  4. USE_CUDNN := 1
  5. # CPU-only switch (uncomment to build without GPU support).
  6. # CPU_ONLY := 1
  7. # uncomment to disable IO dependencies and corresponding data layers
  8. # USE_OPENCV := 0
  9. USE_LEVELDB := 1
  10. # USE_LMDB := 0
  11. # uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
  12. # You should not set this flag if you will be reading LMDBs with any
  13. # possibility of simultaneous read and write
  14. # ALLOW_LMDB_NOLOCK := 1
  15. # Uncomment if you're using OpenCV 3
  16. # OPENCV_VERSION := 3
  17. # To customize your choice of compiler, uncomment and set the following.
  18. # N.B. the default for Linux is g++ and the default for OSX is clang++
  19. # CUSTOM_CXX := g++
  20. # CUDA directory contains bin/ and lib/ directories that we need.
  21. CUDA_DIR := /usr/local/cuda
  22. # On Ubuntu 14.04, if cuda tools are installed via
  23. # "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
  24. # CUDA_DIR := /usr
  25. # CUDA architecture setting: going with all of them.
  26. # For CUDA < 6.0, comment the *_50 lines for compatibility.
  27. CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \
  28. -gencode arch=compute_35,code=sm_35 \
  29. -gencode arch=compute_50,code=sm_50 \
  30. -gencode arch=compute_50,code=compute_50
  31. # BLAS choice:
  32. # atlas for ATLAS (default)
  33. # mkl for MKL
  34. # open for OpenBlas
  35. BLAS := open
  36. # Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
  37. # Leave commented to accept the defaults for your choice of BLAS
  38. # (which should work)!
  39. # BLAS_INCLUDE := /path/to/your/blas
  40. # BLAS_LIB := /path/to/your/blas
  41. # Homebrew puts openblas in a directory that is not on the standard search path
  42. # BLAS_INCLUDE := $(shell brew --prefix openblas)/include
  43. # BLAS_LIB := $(shell brew --prefix openblas)/lib
  44. # This is required only if you will compile the matlab interface.
  45. # MATLAB directory should contain the mex binary in /bin.
  46. # MATLAB_DIR := /usr/local
  47. # MATLAB_DIR := /Applications/MATLAB_R2012b.app
  48. # NOTE: this is required only if you will compile the python interface.
  49. # We need to be able to find Python.h and numpy/arrayobject.h.
  50. #PYTHON_INCLUDE := /usr/include/python2.7 \
  51. /usr/lib/python2.7/dist-packages/numpy/core/include
  52. # Anaconda Python distribution is quite popular. Include path:
  53. # Verify anaconda location, sometimes it's in root.
  54. ANACONDA_HOME := /home/guan/anaconda2
  55. PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
  56. $(ANACONDA_HOME)/include/python2.7 \
  57. $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \
  58. # Uncomment to use Python 3 (default is Python 2)
  59. # PYTHON_LIBRARIES := boost_python3 python3.5m
  60. # PYTHON_INCLUDE := /usr/include/python3.5m \
  61. # /usr/lib/python3.5/dist-packages/numpy/core/include
  62. # We need to be able to find libpythonX.X.so or .dylib.
  63. #PYTHON_LIB := /usr/lib
  64. PYTHON_LIB := $(ANACONDA_HOME)/lib
  65. # Homebrew installs numpy in a non standard path (keg only)
  66. # PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include
  67. # PYTHON_LIB += $(shell brew --prefix numpy)/lib
  68. # Uncomment to support layers written in Python (will link against Python libs)
  69. WITH_PYTHON_LAYER := 1
  70. # Whatever else you find you need goes here.
  71. INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
  72. LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial/
  73. # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
  74. # INCLUDE_DIRS += $(shell brew --prefix)/include
  75. # LIBRARY_DIRS += $(shell brew --prefix)/lib
  76. # Uncomment to use `pkg-config` to specify OpenCV library paths.
  77. # (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
  78. USE_PKG_CONFIG := 1
  79. # N.B. both build and distribute dirs are cleared on `make clean`
  80. BUILD_DIR := build
  81. DISTRIBUTE_DIR := distribute
  82. # Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
  83. # DEBUG := 1
  84. # The ID of the GPU that 'make runtest' will use to run unit tests.
  85. TEST_GPUID := 0
  86. # enable pretty build (comment to see full commands)
  87. Q ?= @

注意修改路径。

执行

  1. make all -j
  2. make runtest
  3. make pycaffe

执行echo "export PYTHONPATH=/opt/cat-dogs/repo/caffe/python:$PYTHONPATH" >> ~/.bashrc这句也可以不添加到.bashrc,可以自己写个env_caffe.sh每次用caffe的时候source env_caffe.sh


编译caffe时出现的问题和解决方法(本地ubuntu16.04和服务器centos)

1.编译caffe时出现的错误

错误

  1. .build_release/src/caffe/proto/caffe.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is

解决方法下载新版本的、编译安装

  1. sudo apt-get install autoconf automake libtool
  2. git clone https://github.com/google/protobuf
  3. ./autogen.sh
  4. ./configure
  5. make
  6. make check
  7. sudo make install

错误

  1. /usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory

解决方法

  1. export CPLUS_INCLUDE_PATH=/usr/include/python2.7
  2. make clean
  3. make all -j2

错误

  1. fatal error: caffe/proto/caffe.pb.h: No such file or directory

解决方法

  1. protoc src/caffe/proto/caffe.proto --cpp_out=.
  2. mkdir include/caffe/proto
  3. mv src/caffe/proto/caffe.pb.h include/caffe/proto

2.make runtest出现的错误

错误

  1. .build_release/tools/caffe: error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory
  2. Makefile:526: recipe for target 'runtest' failed

解决方法添加链接路径

  1. export LD_LIBRARY_PATH=/usr/local/lib/

3.import caffe时出现的错误

错误

No module named google.protobuf.internal

解决方法

/home/guan/anaconda2/bin/pip install protobuf

错误

  1. /home/guan/anaconda2/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found

解决方法

conda install libgcc

错误

No module named google.protobuf.internal

解决方法

/home/guan/anaconda2/bin/pip install protobuf

4.runtest出现的错误

错误

  1. src/caffe/test/test_gradient_based_solver.cpp:373: Failure
  2. The difference between expected_updated_weight and solver_updated_weight is 1.7136335372924805e-07, which exceeds error_margin, where
  3. expected_updated_weight evaluates to 9.6857547760009766e-06,
  4. solver_updated_weight evaluates to 9.8571181297302246e-06, and
  5. error_margin evaluates to 1.0000000116860974e-07.
  6. [ FAILED ] NesterovSolverTest/2.TestNesterovLeastSquaresUpdateWithEverything, where TypeParam = caffe::GPUDevice<float> (6484 ms)

解决方法

执行export CUDA_VISIBLE_DEVICES=0,重新执行测试。

参考runtest出现的问题

ubuntu16.04和服务器 caffe 安装的更多相关文章

  1. 阿里云ECS服务器环境搭建——ubuntu16.04图形界面的安装

    阿里云ECS服务器环境搭建——ubuntu16.04图形界面的安装 最近琢磨着想在服务器上搭建一个hexo博客,于是就在阿里云上买了一个云服务器ECS,远程接入后默认给的是一个命令窗口,没有图形界面, ...

  2. 路由器安装ubuntu-16.04.1-server-amd64出现“无法安装busybox-initramfs”错误。向目标系统中安装busybox-initramfs软件包时出现一个错误。请检查/var/log/syslog或查看第四虚拟控制台以获得详细

    公司的路由器要ubuntu服务器进行路由网络功能的管理,在安装的时候出现下面的错误提示: 安装ubuntu-16.04.1-server-amd64出现“无法安装busybox-initramfs”错 ...

  3. Ubuntu16.04 LTS下apt安装WireShark

    Ubuntu16.04 LTS下apt安装WireShark 安装与配置 首先通过apt安装WireShark: $ sudo apt install wireshark 会同时安装许多的依赖包,其中 ...

  4. ubuntu16.04下sublime text3安装和配置

    ubuntu16.04下sublime text3安装和配置 2018年04月20日 10:31:08 zhengqijun_ 阅读数:1482 1.安装方法 1)使用ppa安装 sudo add-a ...

  5. Ubuntu16.04上用源代码安装ICE

    ubuntu16.04上用源代码安装ICE

  6. Ubuntu16.04下,erlang安装和rabbitmq安装步骤

    文章来源: Ubuntu16.04下,erlang安装和rabbitmq安装步骤 准备工作,先下载erlang和rabbitmq的安装包,注意他们的版本,版本不对可能会导致rabbitmq无法启动,这 ...

  7. caffe搭建--caffe在invidia+cpu 酷睿2Q9300 + ubuntu16.04.2上面的安装和编译过程

    本文原创,转载请注明出处. ------------------------------------------------分割线-------------------------------- 概要 ...

  8. ubuntu16.04+cuda8.0+caffe

    =========== 如果出现nvidia-smi failed to communicate with nvidia driver,循环登录情况,则: sudo apt-get remove -- ...

  9. caffe2+cuda+Ubuntu16.04(u盘安装)

    安装caffe2 预先准备.安装gflags及autoconf及GLOG https://github.com/caffe2/caffe2/issues/1810 一.下载源代码通过网盘 https: ...

随机推荐

  1. LA 4973异面线段

    题目大意:给两条线段求他们间的最小距离的平方(以分数形式输出). 贴个模版吧!太抽象了. #include<cstdio> #include<cmath> #include&l ...

  2. Python入门--1--基本中的基本

    一. 1.这是一个面向对面的编程,一种解释性语言. 2.缩进是python的灵魂,使代码变得非常简洁,正确使用冒号“:”,IDLE的       下一行会自动缩进 3.if语句中 python拒绝接受 ...

  3. 取得mib oidname oid 对应关系表

    snmptranslate -Tz -m ALL > d:\2.txt 取得所有名称与OID的对应表,很有用

  4. Golang 入门 : 等待 goroutine 完成任务

    Goroutine 是 Golang 中非常有用的功能,但是在使用中我们经常碰到下面的场景:如果希望等待当前的 goroutine 执行完成,然后再接着往下执行,该怎么办?本文尝试介绍这类问题的解决方 ...

  5. ThreadGroup

    http://blog.csdn.net/a352193394/article/details/39323427

  6. luogu P1704 寻找最优美做题曲线

    题目背景 nodgd是一个喜欢写程序的同学,前不久(好像还是有点久了)洛谷OJ横空出世,nodgd同学当然第一时间来到洛谷OJ刷题.于是发生了一系列有趣的事情,他就打算用这些事情来出题恶心大家-- 题 ...

  7. android 获得系统时间

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools= ...

  8. Android Studio 2.0 Beta 5公布,修复几个与即时执行相关的严重BUG.

    Android Studio 2.0 Beta 5公布,修复几个与即时执行相关的严重BUG. This build fixes a couple of important bugs related t ...

  9. hadoop-mapreduce中reducetask执行分析

    ReduceTask的执行 Reduce处理程序中须要运行三个类型的处理, 1.copy,从各map中copy数据过来 2.sort,对数据进行排序操作. 3.reduce,运行业务逻辑的处理. Re ...

  10. 数组遍历 map()、forEach() 及 字符串切割 split() / 字符串截取 slice()、substring()、substr()

    JS数组遍历的几种方式 JS数组遍历,基本就是for,forin,foreach,forof,map等等一些方法,以下介绍几种本文分析用到的数组遍历方式以及进行性能分析对比 第一种:普通for循环 代 ...