$ git clone git://github.com/yyuu/pyenv.git ~/.pyenv $ vim ~/.bashrc export PYENV_ROOT=$HOME/.pyenv export PATH=$PYENV_ROOT/bin:$PATH eval "$(pyenv init -)" $ source ~/.bashrc $ pyenv install 3.5.2 Downloading Python-3.5.2.tar.xz... -> https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz Installing Python-3.5.2... patching file Lib/venv/scripts/posix/activate.fish Installed Python-3.5.2 to /home/ml/.pyenv/versions/3.5.2 # Refresh shim $ pyenv rehash # Set version to use $ pyenv global 3.5.2 $ which python $HOME/.pyenv/shims/python # Uninstall $ pyenv uninstall 3.5.2
Now you know pyenv and virtualenv provide us functions like bundler. pyenvとvirtualenvを使って機械学習用のDockerfileを作ってみた。$ which pip $HOME/.pyenv/shims/pip # Sometimes default pip version is low. $ pip install --upgrade pip # Install virtualenv pip install virtualenv # Create virtual environment. # "p" option is for setting python path. # (Just python${VERSION} is enough when you use pyenv) # no option argument is for script instal path for entering virtual environment $ virtualenv -p python3.5 $HOME/.venv35_ml # Enter virtual environment # Prompt will be from "$" to "(.venv35_ml) $" $ source $HOME/.venv35_ml/activate # Basic way to install $ pip install numpy Collecting numpy Downloading numpy-1.9.2.tar.gz (4.0MB) 100% |████████████████████████████████| 4.0MB 91kB/s Installing collected packages: numpy Running setup.py install for numpy Successfully installed numpy-1.9.2 # requirements.txt $ vim requirements.txt django<1.3 urllib3 nose==1.1.2 $ pip install -r requirements.txt Collecting django<1.3 (from -r requirements.txt (line 1)) Downloading Django-1.2.7.tar.gz (6.4MB) 100% |████████████████████████████████| 6.4MB 50kB/s Collecting urllib3 (from -r requirements.txt (line 2)) Downloading urllib3-1.10.2.tar.gz (132kB) 100% |████████████████████████████████| 135kB 989kB/s Collecting nose==1.1.2 (from -r requirements.txt (line 3)) Downloading nose-1.1.2.tar.gz (729kB) 100% |████████████████████████████████| 733kB 416kB/s Installing collected packages: django, urllib3, nose Running setup.py install for django Running setup.py install for urllib3 Running setup.py install for nose Successfully installed django-1.2.7 nose-1.1.2 urllib3-1.10.2 # Check installed library $ pip freeze Django==1.2.7 nose==1.1.2 numpy==1.9.2 urllib3==1.10.2 # Like gemrat $ pip freeze > requirements_new.txt # Exit from virtual environment $ deactivate
docker-ml-sandbox - Dockerfile for machine learning environment(scikit-learn, chainer, gensim, tensorflow, jupyter) zuqqhi2/docker-ml-sandbox - GitHub |
Streamlit is a …
I bought M5Stac…