How to install xgboost in python on MacOS? - python

I am a newbie and learning python. Can someone help me- how to install xgboost in python. Im using Mac 10.11. I read online and did the below mentioned step, but not able to decode what to do next:
pip install xgboost -

It's a little more complicated if you want to use multi-threading. For the record, I am using a Mac with OS X 10.10 (Yosemite). It took me a while to work through the various issues, but it is now running nicely in my Anaconda (Py36) environment.
For multi-threading you need to do the following first (install homebrew if you have not done so):
brew install gcc --without-multilib
You might get some warnings to unlink directories or delete them if you have other versions installed; follow the warnings/instructions.
Next get the xgboost files from Github. I downloaded it to Anaconda/pkgs directory.
git clone --recursive https://github.com/dmlc/xgboost
The next series of steps differ from the documentation on the xgboost site, and I cobbled it together from lots of sources and also experimenting. The problem is that some key lines in the make files are commented out and also not fully specified.
cd xgboost; cp make/config.mk ./config.mk
Now, use your favorite editor (I used vi), and go into the file that you copied from /make to /xgboost
vi config.mk
Uncomment the lines near the top of the file:
export CC = gcc
export CXX = g++
Change them to the following:
export CC = gcc-6
export CXX = g++-6
It is possible that simply uncommenting the lines solves the problem. It did not for me; I needed to add the -6 to both lines. Save the file.
Also, make changes to the file xgboost/Makefile; change lines:
export CC = $(if $(shell which clang), clang, gcc)
...
...
export CXX = $(if $(shell which clang++), clang++, g++)
to the following:
export CC = $(if $(shell which clang), clang, gcc-6)
...
...
export CXX = $(if $(shell which clang++), clang++, g++-6)
Again, I used vi for this editing.
Save the file and now you need to run a cleaning step since you changed the Makefile.
make clean_all && make -j4
This should configure it cleanly and build the library. You still need to install it.
cd python-package; python setup.py install
Now restart Python/Anaconda and you should be able to import the library.

If you have Conda installed, this is what worked for me:
Simply type in the terminal:
conda install -c conda-forge xgboost

For a newbie learning python and Machine Learning on Mac, I would strongly recommand to install Anaconda first (install doc).
Anaconda is a freemium open source distribution of the Python and R
programming languages for large-scale data processing, predictive
analytics, and scientific computing, that aims to simplify package
management and deployment.
If you installed Anaconda for Python 2.7, then you should have no troubles installing XGBoost with:
conda install -c aterrel xgboost=0.4.0
If you already have Anaconda installed and that your pip XGBoost installation failed, you should try:
conda remove xgboost
conda install -c aterrel xgboost=0.4.0

FOR PYTHON 2.7
$ conda install -c aterrel xgboost=0.4.0
OR
$ conda install -c biconda xgboost=0.6a2
FOR PYTHON 3.6
$ brew install gcc#5
$ pip install xgboost

For Python-3.x, do the following in Mac
Make sure gcc-6 (and g++-6) is installed, if not do so with
brew install gcc
Then, do the following
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost/
make -j4
cd python-package
python3 setup.py install
If you are using Anaconda and haven't yet configured your path to use the binaries in ~/anaconda/bin, then run the last line as
/path/to/anaconda/bin/python3 setup.py install

I followed Bryan Butler's answer and it worked, I just needed to make some changes:
gcc-7/g++-7 instead of gcc-6/g++-6.
While running make clean_all && make -j4 I had an error with as. So, I just had to run export PATH=/usr/bin:$PATH and it worked!

Im running Mac OS Mojave 10.14.5 and following the "advanced method" instructions for Mac OS at https://xgboost.readthedocs.io/en/latest/build.html# worked for me. In short:
brew install cmake
brew install gcc#8
git clone --recursive https://github.com/dmlc/xgboost
mkdir xgboost/my_build
cd xgboost/my_build
CC=gcc-8 CXX=g++-8 cmake ..
make -j4
cd ../python_package
python3 setup.py install

You can pip install catboost.
It is a recently open-sourced gradient boosting library, it has similar interfaces and is more accurate, than XGBoost, faster and has categorical features support out of the box. Here is the site of the library: https://catboost.yandex

All the other ways described here failed in my case. I managed to install by following the official installation described here:
http://xgboost.readthedocs.io/en/latest/build.html#building-on-macos
My system is MacOS Serria so I followed the instruction of "Building on macOS".
However, instead of "replacing these two lines into(5 or 6 or 7; depending on your gcc-version" w.r.t. the config.mk file, I did:
export CC = gcc-5
export CXX = g++-5
Even though gcc-version showed Apple LLVM version 9.0.0.
After that by following the official instruction of "Python Package Installation" I was able to run the package in Python.

March 2021 - No problem installing XGBoost 1.3.3 using pip
> pip3 install xgboost
>>> import xgboost as xgb
>>> xgb.__version__
'1.3.3'

Related

Anaconda Python: ModuleNotFoundError: No module named 'matlab'

I'm new to Python and Linux and want to install a MATLAB Engine for Python 3.6. I already followed the steps from Mathworks (http://www.mathworks.com/help/matlab/matlab-engine-for-python.html)
and tried also to use python setup.py build --build-base=$(mktemp -d) install but the error still appears. I have MATLAB R2018a installed and use Spyder 3.2.8 with Anaconda.
Does someone has an advice?
Thanks in advance!
If you're trying to install matlab engine in a conda environment, follow the below steps:
cd "matlabroot\extern\engines\python"
python setup.py install --prefix="installdir"
Eg
cd /opt/MATLAB/R2019a/extern/engines/python
python setup.py install --prefix="/home/nagabhushan/anaconda3/"
Now, matlab engine package is actually installed under the separate
anaconda3/lib/python3.6/site-package/matlab
So you need to manually move that matlab folder to the site-package folder your python is using. If you have multiple virtual envs, move it to the corresponding site-package folder of the virtual env you will run program.
Eg
anaconda3/envs/my_env/lob/python3.6/site-packages/matlab
References:
https://stackoverflow.com/a/41800724/3337089
https://stackoverflow.com/a/56553740/3337089
Edit 1 (03-Mar-2020):
I tried activating my environment and then simply installing matlab engine and it worked! I'm using Python 3.7
python setup.py install
Note that this initially gave error that error: You do not have write permission in build/lib/matlab/engine/, but changing the permission of build directory recursively worked: sudo chmod -R 777 build/
Following Nagabhushan S N answer,here, in order to install matlab/matlab.engine with conda (miniconda3) with Linux Ubuntu 18 LTS and Matlab 2018, I performed the following steps.
I have created a new conda enviroment (python36) with Python 3.6 interpreter, Python 3.6 is one of the supported version by Matlab 2018 (and you need to match the right Pyhton version or it'll install Python 2.7 libs), and I have directly installed the libs in the python36 env subfolder, in detail:
cd /usr/local/MATLAB/R2018a/extern/engines/python
python setup.py install --prefix="/home/myname/miniconda3/envs/python36"
e.g., import matlab.engine is now usable from the python36 environment.
P.s: the installation needs write access to the build subfolder (under usr/local...), so you need to go sudo and chmod -R +777 /usr/local/MATLAB/R2018a/extern/engines/python/build
P.s.2: by installing only in a base env, in my case, does not provide matlab.engine to work with the other conda envs too.. perhaps this is a normal, expected, conda behaviour.
After many tests I think I solved the problem. I will post the answer if someone has the same problems. As mentioned here:
https://stackoverflow.com/a/39759581/9834571
You can add an alternative python command. For me it worked when I vary the mentioned example as followed:
sudo update-alternatives --install /usr/bin/python python ~/anaconda3/envs/ 2
update-alternatives --display python
cd /usr/local/MATLAB/R2018a/extern/engines/python/
python setup.py build --build-base=$(mktemp -d) install

How can I install XGBoost package in python on Windows

I tried to install XGBoost package in python.
I am using windows os, 64bits . I have gone through following.
The package directory states that xgboost is unstable for windows and is disabled:
pip installation on windows is currently disabled for further invesigation, please install from github.
https://pypi.python.org/pypi/xgboost/
I am not well versed in Visual Studio, facing problem building XGBoost.
I am missing opportunities to utilize xgboost package in data science.
Please guide, so that I can import the XGBoost package in python.
Thanks
If you are using anaconda (or miniconda) you can use the following:
conda install -c anaconda py-xgboost UPDATED 2019-09-20
Docs
Other channels available, such as rapidsai/py-xgboost UPDATED 2021-12-07
Check install by:
Activating the environment (see below)
Running conda list
To activate an environment:
On Windows, in your Anaconda Prompt, run (assumes your environment is named myenv):
activate myenv
On macOS and Linux, in your Terminal Window, run (assumes your environment is named myenv):
source activate myenv
Conda prepends the path name myenv onto your system command.
Build it from here:
download xgboost whl file from here (make sure to match your python version and system architecture, e.g. "xgboost-0.6-cp35-cp35m-win_amd64.whl" for python 3.5 on 64-bit machine)
open command prompt
cd to your Downloads folder (or wherever you saved the whl file)
pip install xgboost-0.6-cp35-cp35m-win_amd64.whl (or whatever your whl file is named)
You first need to build the library through "make", then you can install using anaconda prompt (if you want it on anaconda) or git bash (if you use it in Python only).
First follow the official guide with the following procedure (in Git Bash on Windows):
git clone --recursive https://github.com/dmlc/xgboost
git submodule init
git submodule update
then install TDM-GCC here and do the following in Git Bash:
alias make='mingw32-make'
cp make/mingw64.mk config.mk; make -j4
Last, do the following using anaconda prompt or Git Bash:
cd xgboost\python-package
python setup.py install
Also refer to these great resources:
Official Guide
Installing Xgboost on Windows
Installing XGBoost For Anaconda on Windows
You can pip install catboost. It is a recently open-sourced gradient boosting library, which is in most cases more accurate and faster than XGBoost, and it has categorical features support.
Here is the site of the library:
https://catboost.ai
pip install xgboost works also with python 3.8, whereas other options mentioned above did not work for me
The following command should work but, If you have a problem with this command
conda install -c conda-forge xgboost
First activate your environment . Assume your environment is named
simply write in conda terminal :
activate <MY_ENV>
and then
pip install xgboost
on a macOS the following command worked
conda install -c conda-forge xgboost but before doing this i had read some other article and hence did install gcc using brew
Besides what's already on developers' github, which is building from source(creating a c++ environment, etc.), I have found an easier way to do it, which I explained here with details. Basically, you have to go a website by UC Irvine and download a .whl file, then cd to the folder and install xgboost with pip.
XGBoost is used in Applied Machine Learning and is known for its gradient boost algorithm and it is available as a library in python but has to be compiled using cmake.
Alternatively what you can do is from this link you can download the C pre-compiled library and install it using the pip install < FILE-NAME.whl> command. Ensure you have downloaded the library which is compatible with your python version.
I experienced this problem while I was using the same in Anaconda(Spyder). Then just restart the kernel and your error will go away.

How to install xgboost in Anaconda Python (Windows platform)?

I am a new Python user. I downloaded the latest Anaconda 3 2.4.1 (Python 3.5) from the below link:
https://www.continuum.io/downloads
My PC Configurations are: Windows 10, 64 bit, 4GB RAM
I have spent hours trying to find the right way to download the package after the 'pip install xgboost' failed in the Anaconda command prompt but couldn't find any specific instructions for Anaconda.
Can anyone help on how to install xgboost from Anaconda?
The easiest way (Worked for me) is to do the following:
anaconda search -t conda xgboost
You will get a list of install-able features like this:
for example if you want to install the first one on the list mndrake/xgboost (FOR WINDOWS-64bits):
conda install -c mndrake xgboost
If you're in a Unix system you can choose any other package with "linux-64" on the right.
Update on 22/10/2020:
Without searching in conda list of channels, you can install it using (source: https://anaconda.org/anaconda/py-xgboost) :
conda install -c anaconda py-xgboost
Anaconda's website addresses this problem here: https://anaconda.org/anaconda/py-xgboost.
conda install -c anaconda py-xgboost
This fixed the problem for me with no problems.
Download package from this website.
I downloaded xgboost-0.6-cp36-cp36m-win_amd64.whl for anaconda 3 (python 3.6)
Put the package in directory C:\
Open anaconda 3 prompt
Type cd C:\
Type pip install C:\xgboost-0.6-cp36-cp36m-win_amd64.whl
Type conda update scikit-learn
After trying some things the only thing that worked for me is:
conda install -c anaconda py-xgboost
I was able to install xgboost for Python in Windows yesterday by following this link. But when I tried to import using Anaconda, it failed. I recognized this is due to the fact that Anaconda has a different Python distribution. I then searched again and found this great article which made it!
The trick is after installing successfully for regular Python, to have it work for Anaconda, you just need to pull up the Anaconda prompt and cd into this folder "code\xgboost\python-package", then run:
python setup.py install
And voila! The article says you need to add the path, but for me it worked directly. Good luck!
Also copied below the original contents in case the link is not available...
Once the last command completes the build is done. We can now install
the Python module. What follows depends on the Python distribution
you are using. For Anaconda, I will simply use the Anaconda prompt,
and type the following in it (after the prompt, in my case [Anaconda3]
C:\Users\IBM_ADMIN>):
[Anaconda3] C:\Users\IBM_ADMIN>cd code\xgboost\python-package
The point is to move to the python-package directory of XGBoost. Then type:
[Anaconda3] C:\Users\IBM_ADMIN\code\xgboost\python-package>python setup.py install
We are almost done. Let's launch a notebook to test XGBoost.
Importing it directly causes an error. In order to avoid it we must
add the path to the g++ runtime libraries to the os environment path
variable with:
import os
mingw_path = 'C:\\Program Files\\mingw-w64\\x86_64-5.3.0-posix-seh-rt_v4-rev0\\mingw64\\bin'
os.environ['PATH'] = mingw_path + ';' + os.environ['PATH']
We can then import xgboost and run a small example.
import xgboost as xgb
import numpy as np
data = np.random.rand(5,10) # 5 entities, each contains 10 features
label = np.random.randint(2, size=5) # binary target
dtrain = xgb.DMatrix( data, label=label)
dtest = dtrain
param = {'bst:max_depth':2, 'bst:eta':1, 'silent':1, 'objective':'binary:logistic' }
param['nthread'] = 4
param['eval_metric'] = 'auc'
evallist = [(dtest,'eval'), (dtrain,'train')]
num_round = 10
bst = xgb.train( param, dtrain, num_round, evallist )
bst.dump_model('dump.raw.txt')
We are all set!
I'm able to install using the following commands (in Windows 10) :
conda install -c mikesilva xgboost
conda install -c conda-forge xgboost
GUYS ITS NOT THAT EASY:-
PLEASE FOLLOW BELOW STEP TO GET TO MARK
So here's what I did to finish a 64-bit build on Windows:
Download and install MinGW-64: sourceforge.net /projects/mingw-w64/
On the first screen of the install prompt make sure you set the Architecture to x86_64 and the Threads to win32
I installed to C:\mingw64 (to avoid spaces in the file path) so I added this to my PATH environment variable: C:\ mingw64 \ mingw64 \ bin(Please remove spaces)
I also noticed that the make utility that is included in bin\mingw64 is called mingw32-make so to simplify things I just renamed this to make
Open a Windows command prompt and type gcc. You should see something like "fatal error: no input file"
Next type make. You should see something like "No targets specified and no makefile found"
Type git. If you don't have git, install it and add it to your PATH.
These should be all the tools you need to build the xgboost project. To get the source code run these lines:
cd c:\
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
git submodule init
git submodule update
cp make/mingw64.mk config.mk
make -j4
Note that I ran this part from a Cygwin shell. If you are using the Windows command prompt you should be able to change cp to copy and arrive at the same result. However, if the build fails on you for any reason I would recommend trying again using cygwin.
If the build finishes successfully, you should have a file called xgboost.exe located in the project root. To install the Python package, do the following:
cd python-package
python setup.py install
Now you should be good to go. Open up Python, and you can import the package with:
import xgboost as xgb
To test the installation, I went ahead and ran the basic_walkthrough.py file that was included in the demo/guide-python folder of the project and didn't get any errors.
if you found an issue when you try to import xgboost (my case it is Windows 10 and anaconda spyder) do the following:
Click on the windows icon (start button!)
Select and expand the anaconda folder
Run the Anaconda Prompt (as Administrator)
Type the following command as it is mentioned in https://anaconda.org/anaconda/py-xgboost
conda install -c anaconda py-xgboost
That's all...Good luck.
You can download the xgboost package to your local computer, and you better place the xgboost source file under D:\ or C:\ (ps: download address: http://www.lfd.uci.edu/~gohlke/pythonlibs/#xgboost, and select "xgboost-0.6-cp35-cp35m-win_amd64.whl",but it is up to your operation system), and you open the Anaconda prompt, type in pip install D:\xgboost-0.6-cp35-cp35m-win_amd64.whl, then you can successful install xgboost into your anaconda
Try running this on Anaconda prompt
pip install xgboost
This worked for me on Spyder with Python 3.5
I figured out easy way to install XgBoost by mix of what is mentioned here.
Step 1:
Install gitbash from here and start gitbash.
Step 2: git clone --recursive https://github.com/dmlc/xgboost
Step 3: git submodule init
git submodule update
step 4: alias make='mingw32-make'
step 5: cp make/mingw64.mk config.mk; make -j4
step 6: Goto Anaconda prompt and if you have a conda environment then activate that environment like my was py35 so I activate it by typing activate py35
cd python-package
python setup.py install
step 7: setup the Path in system environment variable to the path where you installed xgboost/python-package.
Use this in your conda prompt:
python -m pip install xgboost
The following worked for me:
conda install libxgboost
The package directory states that xgboost is unstable for windows and is disabled:
pip installation on windows is currently disabled for further invesigation, please install from github.
https://pypi.python.org/pypi/xgboost/
Anaconda3 version 4.4.0check image
Go to Anaconda -> Environments -> from the dropdown select not installed -> If you can see xgboost pr Py-xgboost select and click apply.
There are a lot of dependencies of anaconda that have changed over the past years and won't work if you used them now. Some of the answers need serious updation.
I found this command did the job for me :
conda install -c conda-forge xgboost
You may also want to look at the official documentation of anaconda for xgboost:
https://anaconda.org/conda-forge/xgboost
I have used this command and it worked for me.
import sys
!{sys.executable} -m pip install xgboost
Open anaconda prompt and run
pip install xgboost
You can install it using pip:
pip3 install --default-timeout=100 xgboost
This simple helped me you don't have to include anything at the end because if you include something, some of your packages will be upgraded but some will be downgraded.
You can get this from this url: https://anaconda.org/anaconda/py-xgboost
conda install -c anaconda py-xgboost
Look here https://github.com/Rafi993/xgboost/ for building xgboost on your machine. There are many different varieties of the solution above, but it seems that the version in the link above is the good one. At least that worked for me: I've tested it on Windows 7 and Windows Server 2008.
Then run the following commands in cmd in order to install python bindings:
cd python-package
python setup.py install
You might also need a proper mingw (google for tdm-gcc)
and the latest setuptools from anaconda.
I hope it will help

Installing matplotlib on RedHat ideally using yum

I can't seem to find documentation on this. Matplotlib says to run:
sudo yum install python-matplotlib
which installs all the dependancies and this version of matplotlib successfully:
python-matplotlib.x86_64 0:0.99.1.2-1.6.amzn1
However, I use python2.7, separately installed. The original (and still existing) python2.6 now imports matplotlib successfully. Is there a related matplotlib package on RedHat for python2.7? I don't know how to use this page on python-matplotlib packages.
Other info:
which python2.6 returns /usr/bin/python2.6
which python returns /usr/bin/python.
cat /proc/version returns
Linux version 3.14.23-22.44.amzn1.x86_64 ... (Red Hat 4.8.2-16) (GCC) ...
Something else I tried:
I also tried to use pip2.7 instead, installed all the dependancies, and it broke on this issue concerning permissions. The solution is to reset the permissions of the problem file with:
chmod o+x /path/to/file
However, it's a temporary copied file. :( During the install of matplotlib it recopies this file over, so I can't set permissions on it. Here is the place it is broken:
g++ ... -lpython2.7 -o build/lib.linux-x86_64-2.7/matplotlib/backends/_backend_agg.so
running install_lib
copying pylab.py -> /usr/lib64/python2.7/site-packages
error: [Errno 13] Permission denied: '/usr/lib64/python2.7/site-packages/pylab.py'
This doesn't seem like the right way to do it, it's too cobbled together.
Question asked first at the Unix&Linux stackexchange.
I built from source. :( Surprisingly not that difficult, but ran into a lot of problems doing the interactive part (Redhat 4 is too old to have packages for most things that let you do interactive backends, I need a newer machine).
# get matplotlib
wget https://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.4.3/matplotlib-1.4.3.tar.gz
#uncompress
tar xvzf matplotlib-1.4.3.tar.gz
# open build install
# read INSTALL file for more instructions
cd matplotlib-1.4.3
python setup.py build
# actually installing needed superuser privileges
sudo python setup.py install
Hope this saves time for anyone else with a similar setup.
On centos 7 I installed python 3.6.1, into /usr/local
This also automatically installed pip
Then I ran sudo /usr/local/bin/pip3.6 install matplotlib
and it was all good

How to properly install Python on OSX for use with OpenCV?

I spent the past couple of days trying to get opencv to work with my Python 2.7 install. I kept getting an error saying that opencv module was not found whenever I try "import cv".
I then decided to try installing opencv using Macports, but that didn't work.
Next, I tried Homebrew, but that didn't work either.
Eventually, I discovered I should modify the PYTHONPATH as such:
export PYTHONPATH="/usr/local/lib/python2.6/site-packages/:$PYTHONPATH"
My problem is that I didn't find /usr/local/lib/python2.*...etc
The folder simply doesn't exist
So my question is this:
How do I properly install Python on OS X Snow Leopard for it to work with opencv?
Thanks a lot,
I spent a couple days on this myself. For me, the problem was that that OpenCV installer was not finding the right python installation. It was defaulting to the MacOS-installed version despite the fact that I had upgraded python with homebrew and was using a virtualenv for python. I have collected most of my setup in a gist here:
https://gist.github.com/4150916
Use homebrew to get all the dependencies, but then download the OpenCV tarball and compile yourself being sure to specify all the python related configuration options.
Assuming a virtualenv named 'opencv'...
cd OpenCV-2.4.3/
mkdir release
cd release
cmake -D PYTHON_EXECUTABLE=$WORKON_HOME/opencv/bin/python \
-D PYTHON_PACKAGES_PATH=$WORKON_HOME/opencv/lib/python2.7/site-packages \
-D INSTALL_PYTHON_EXAMPLES=ON\
-D PYTHON_INCLUDE_DIR=/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Headers\
-D PYTHON_LIBRARY=/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib\
..
make -j8
make install
You need to install the module using your python2.7 installation. Pointing your PYTHONPATH at stuff installed under 2.6 to run under 2.7 is a Bad Idea.
Depending on how you want to install it, do something like python2.7 setup.py or easy_install-2.7 opencv to install.
fwiw, on OS X the modules are usually installed under /System/Library/Frameworks/Python.framework/ but you should almost never need to know where anything installed in your site packages is physically located; if Python can't find them without help you've installed them wrong.
Installing OpenCV with Homebrew
brew tap homebrew/homebrew-science
brew install opencv
Setting up Python
Depending on your install location - OS X Default
cd /Library/Python/2.7/site-packages/
or - Homebrew Python
cd /usr/local/lib/python2.7
Then create the symbolic link
ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py cv.py
ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv2.so cv2.so
The above method sourced from a blog post.
I searched and tried installing opencv3 with python3 for 3 days. Some links suggest for Brew and some virtual env, some say install xcode but all failed in my case.
Dont use linux steps to instal opencv-python on Mac. Problem with Mac is Python 2.7 is already installed by Mac. On top of that installing and linking all site-packages is little problematic and we end up with errors.
I'll share what I did: easy steps to install complete package opencv3, numpy, matplotlib, notebook, spyder etc.. on Mac.
Install anaconda, it creates a directory and install everything inside that
use this link -> https://www.continuum.io/downloads
download command-line-install
After download, goto terminal and download location of anaconda.
$ bash Anaconda3-4.3.0-MacOSX-x86_64.sh
Installation will ask you to append path to .bash_profile >> say yes
Goto home directory, run .bash_profile
$ source .bash_profile
check python, should be pointing to
$ which python
$ /.../anaconda/bin/python
Last step
$ pip install opencv-pyhton
$ python
$ import cv2
if no errors, we are good to go.

Categories

Resources