VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "bento/ubuntu-18.04" config.vm.hostname = "ub1804pipenvopencv" config.vm.provider :virtualbox do |vbox| vbox.name = "ub1804pipenvopencv" vbox.cpus = 4 vbox.memory = 4096 vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"] end config.vm.network "private_network", ip: "192.168.55.119", :netmask => "255.255.255.0" config.vm.network "public_network", ip:"192.168.1.119", :netmask => "255.255.255.0" config.vm.provision "shell", inline: <<-SHELL apt-get update DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade locale-gen ja_JP.UTF-8 localectl set-locale LANG=ja_JP.UTF-8 timedatectl set-timezone Asia/Tokyo # install pipenv apt-get -y install python3.6 python3-distutils apt-get -y install python-pip #pip install --upgrade pip pip install pip==9.0.1 pip install --upgrade setuptools pip install pipenv # install OpenCV sudo apt-get update sudo apt-get -y upgrade sudo apt-get -y install \ build-essential \ cmake \ git \ libjpeg-dev \ libpng-dev \ libtiff-dev \ libgtk2.0-dev \ libavcodec-dev \ libavformat-dev \ libswscale-dev \ python-dev \ python-numpy \ libtbb2 \ libtbb-dev \ libdc1394-22-dev # create a environment for test. mkdir /home/vagrant/opencv cd /home/vagrant/opencv pipenv --python 3.6 pipenv install opencv-python pipenv install opencv-contrib-python #pipenv shell cat << EOF > /home/vagrant/opencv/test.py import cv2 print(cv2.__version__) EOF pipenv run python test.py SHELL end
2020年1月6日月曜日
VagrantでpipenvとOpenCVをインストールした仮想マシン(Ubuntu18.04)を構築する
pipenvの仮想環境内にopencv-pythonをインストールした仮想マシンを構築するには、以下のVagrantfileを使用します。
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿