![]() ![]() First make sure you have (cv3) in front of your command line, if not, hit workon cv3 to enter the environment.cpython-37m-darwin.so cv2.so All DoneĪnd now, you should have openCV installed with Python3.7, to test: cd ~/.virtualenvs/cv/lib/python3.7/site-packages/ ln -s -f /usr/local/opt/opencv/lib/python3.7/site-packages/cv2. If you see there, nice! If not, run the next few commands with the. To make sure we have the correct path, first use the following command to determine the name of your cv2 so file ls /usr/local/opt/opencv/lib/python3.7/site-packages/Īnd make sure there’s a file name the same as the bolded string in the next commands. Install it by typing the following: workon cv3 pip3 install numpy pip install matplotlib deactivate Set a symbolic link to the OpenCV 3 bindings NumPy is a tool for scientific computing in Python. It should work now as you can type workon cv3 to enter the virtual environment, and if you want to quit the environment, hit deactivate Install NumPy ![]() Then, add the following commands to this file: export WORKON_HOME=$HOME/code/.virtualenvs export PROJECT_HOME=$HOME/code export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='-no-site-packages'Īnd finally, create a virtual wrapper by typing: mkvirtualenv cv3 -p python3 If not so, modify yours to make it looks like mine. bash_profile.pysave PATH="/Library/Frameworks/amework/Versions/3.7/bin:$" export PATH export PATH=/usr/local/bin:$PATH Open your source file by executing nano ~/.bash_profile, make sure your file looks like this: # Setting PATH for Python 3.7 # The original version is saved in. Now, in order to prevent the error that OpenCV is not installed with python2, install using pip2.7, (details here) pip2.7 install virtualenv virtualenvwrapper Update Source File (again) ![]() That way, open CV will work with python3. Install OpenCV using the following command: brew install opencv3 -with-contrib -with-python3 Please write the version number down on a piece of paper for future command reference. It should return your installed python3 version, which is Python 3.7.0 in my case. Install the newest version of python through Homebrew brew install python3Īnd here’s a command to check the version of your python: python3 -version Type the following line in the command in order to update the bash file you just entered into the system: source ~/.bash_profile brew update Install Python using Homebrew Then, use control-O to write the file, hit enter to confirm path, and then use control-X to exit. And add this line in the file at the end export PATH=/usr/local/bin:$PATH Here, nano is like a text editor in command line. To install Homebrew if you haven’t, type the following commands: /usr/bin/ruby -e "$(curl -fsSL )" “The missing package control for mac OS” Homebrew helps you install packages with just a few commands. sudo xcode-select -install Install Homebrew If you don’t, follow these steps to install it in command line. (If you get an output like `/Library/Developer/CommandLineTools`, you’re good to go) Don’t worry, it will just output a path) sudo xcode-select -p (You’ll need to input your root password for this commend. If you already have Xcode installed for development purposes, you’re good to go! If you’re unsure, you can check if it’s already installed by typing the following line: After some exploration, I have successfully installed it and able to call open CV in Python 3. Installing OpenCV and Python 3.7 using Homebrew on macOS Mojave with virtual wrapperīefore writing this story, I have been confused with the installation of the virtual wrapper on the newest version of macOS and Python. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |