In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to compile Caffe under Ubuntu14.04+CUDA8.0+Anaconda2+Python2.7", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to compile Caffe under Ubuntu14.04+CUDA8.0+Anaconda2+Python2.7" this article.
Linux version: Ubuntu14.04 64-bit
Anaconda version: Anaconda2-4.3.1-Linux-x86_64
Python version: Python2.7
OpenCV version: OpenCV3
CUDA version: CUDA8.0
Premise: video card driver, CUDA8.0, cuDNN5.0 have been installed and configured environment variables.
First, install Anaconda2
URL: https://www.continuum.io/downloads/
Wget https://repo.continuum.io/archive/Anaconda2-4.3.1-Linux-x86_64.sh
After the download is successful, execute on the terminal:
Bash Anaconda2-4.3.1-Linux-x86_64.sh
During the installation process, you will ask the installation path and press enter. Ask if you want to add it to ~ / .bashrc and reply to yes.
After the installation is complete, source ~ / .bashrc and execute the command as follows:
Source / .bashrc
Then, enter the following command to view the libraries that have been installed:
Conda list
To install the libraries you need, execute the following command:
Conda install *
To update the version of a package, execute the following command:
Conda update *
Let's update our conda with the following command:
Conda update conda
Create an environment, such as testcaffe:
Conda create-n testcaffer python
Note: Anaconda2 supports python2.7 by default. If Anaconda3 supports python3 by default, you can use the following command to create an environment for python2.7:
Conda create-n testcaffe python=2.7
To enter the environment after you have created it, use the following command:
Source activate testcaffe
You can also exit the environment you created by using the following command:
Source deactivate
Install OpenCV3:
Conda install-c menpo opencv3
Second, install dependent libraries
Sudo apt-get updatesudo apt-get upgradesudo apt-get install- y build-essential cmake git pkg-configsudo apt-get install- y libprotobuf-dev libleveldb-dev libsnappy-dev protobuf-compilersudo apt-get install- y libatlas-base-dev sudo apt-get install- y-- no-install-recommends libboost-all-devsudo apt-get install- y libgflags-dev libgoogle-glog-dev liblmdb-dev
3. Compile Caffe and PyCaffe
URL: https://github.com/BVLC/caffe.git
1. Download Caffe
Git clone https://github.com/BVLC/caffe.gitcd caffe
two。 Compile caffe
Use the default configuration of cmake:
Cmake.. make all-j8make install make runtest-J8
3. Install the dependency packages required by pycaffe and compile pycaffe
Cd.. / pythonconda install cython scikit-image ipython h6py nose pandas protobuf pyyaml jupyterfor req in $(cat requirements.txt); do pip install $req; donecd.. / buildmake pycaffe-J8
4. Add environment variables for pycaffe
The terminal enters the following instructions:
Vim / .bashrc
Add the python path to caffe on the last line (shortcut key to the last line of vim: Shift+G):
Export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH
Note: / path/to/caffe is the root directory of the downloaded Caffe, for example, my path is: / home/Jack-Cui/caffe
Source environment variable, execute the following command on the terminal:
Source / .bashrc
Note: when Source is finished with the environment variable, it will exit the conda environment of testcaffe, and use the command to enter it again.
IV. Testing
Execute the following command:
Python-c "import caffe; print dir (caffe)"
The output is as follows:
As you can see from the figure above, caffe is compiled, and some caffe interfaces for python also exist.
Note: if you have created a conda environment, you need to enter the created conda environment every time you want to use caffe.
The above is all the contents of the article "how to compile Caffe under Ubuntu14.04+CUDA8.0+Anaconda2+Python2.7". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.