Python environment construction

procedure

  1. Install pyenv
  2. Install python
  3. Install virtualenv
  4. Install anaconda
  5. Virtual environment construction
  6. Set the virtual environment as the working directory
  7. Script execution

1. Install pyenv

pyenv: python version control tool

$ brew install pyenv
$ pyenv --version
$ echo 'if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi' >> ~/.bash_profile

2. Install python

$ pyenv install -l
$ pyenv install [Installation ver]
$ pyenv versions

Change python version of pc itself

$ pyenv global [Ver you want to use]
$ pyenv rehash
$ pyenv version
$ python3 --version

Change the version under a specific directory

$ pyenv local [Ver you want to use]

http://www.task-notes.com/entry/20141215/1418612400

3. Install virtualenv

virtualenv: for creating different environments with the same (python) version

$ pip install virtualenv

4. Install anaconda

anaconda: A collection of packages (NumPy, SciPy, pandas, matplotlib, scikit-learn, etc.)

$ pyenv install -l
$ pyenv install [Anaconda ver]
$ pyenv global [Anaconda ver]
$ pyenv versions

5. Virtual environment construction

$ conda create -n [Virtual environment name] python(=3.6) (anaconda)
$ conda info -e //Environment list
$ source activate [Virtual environment name] //Enter the virtual environment
$ source deactivate //Get out of the virtual environment
$ conda remove -n [Virtual environment name] --all //Delete virtual environment

http://creata.hatenablog.com/entry/2016/12/18/174533

6. Set the virtual environment as the working directory

$ cd [Working directory]
$ pyenv local [Anaconda ver]/envs/[Virtual environment name]
$ echo 'alias activate="source [User directory]/versions/anaconda3-4.4.0/bin/activate"' >> ~/.bash_profile
$ source ~/.bash_profile
$ activate //Enter the virtual environment

http://qiita.com/togoturns/items/b2ae361a669933c823f5 Solved the problem that terminal crashes: http://qiita.com/y__sama/items/f732bb7bec2bff355b69

7. Script execution

$ activate [Virtual environment name]
$ python [file name].py

Recommended Posts

Python environment construction
Environment construction (python)
python environment construction
Python --Environment construction
Python environment construction
python environment construction
python windows environment construction
homebrew python environment construction
Mac environment construction Python
Python environment construction @ Win7
Python + Anaconda + Pycharm environment construction
Python environment construction (Windows10 + Emacs)
CI environment construction ~ Python edition ~
Python environment construction For Mac
Anaconda3 python environment construction procedure
Python3 environment construction (for beginners)
Python environment construction and TensorFlow
Python environment construction under Windows7 environment
[MEMO] [Development environment construction] Python
Environment construction of python2 & 3 (OSX)
Django environment construction
Environment construction of python and opencv
Python environment construction memo on Windows 10
DeepIE3D environment construction
Get started with Python! ~ ① Environment construction ~
Linux environment construction
Anaconda python environment construction on Windows 10
python environment settings
python windows environment
Python environment construction memo on Mac
django environment construction
Python environment construction (pyenv, anaconda, tensorflow)
[Python3] Development environment construction << Windows edition >>
CodeIgniter environment construction
Python environment construction (pyenv + poetry + pipx)
Environment construction of python3.8 on mac
Python3 environment construction with pyenv-virtualenv (CentOS 7.3)
Python3 TensorFlow for Mac environment construction
Emacs Python development environment construction memo
pytorch @ python3.8 environment construction with pipenv
Golang environment construction
[docker] python3.5 + numpy + matplotlib environment construction
Python3.6 environment construction (using Win environment Anaconda)
OpenCV3 & Python3 environment construction on Ubuntu
Word2vec environment construction
[Ubuntu 18.04] Python environment construction with pyenv + pipenv
Python project environment construction procedure (for windows)
[Python] Road to snake charmer (1) Environment construction
Python3 + venv + VSCode + macOS development environment construction
VScode environment construction (Windows10, Python, C ++, C, Git)
Environment construction procedure: Ubuntu + Apache2 + Python + Pyramid
Python and machine learning environment construction (macOS)
Let's get along with Python # 0 (Environment construction)
Windows + gVim + Poetry python development environment construction
[Python] Get environment variables
My python environment memo
Environment construction: GCP + Docker
Django project environment construction
Unification of Python environment
Go language environment construction
ConoHa environment construction memo