Creating amateur python environment settings (for MAC)

At the beginning

Let's write the setting order of python so that the true beginner can understand. However, it is assumed that you have enough knowledge about the terminal (something black screen). It is for setting tensorflow for deep learning, but aim for a level where the library can be set. Or rather, I bought a macbook Pro and wrote my own notes that I was rebuilding.

homebrew The one that is convenient for installation and settings. from here. Http://brew.sh/index_ja.html ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" But it looks good.

pyenv and pyenv-virtualenv

When using python, it seems that it is better to distinguish between the part used as a system and the part that you move by yourself, so I will put in a tool for managing python. Don't get in the way of people who work hard. No detailed explanation will be given. $ brew install pyenv-virtualenv It seems that you can enter all at once.

PATH setting

I will describe it in detail because it is a part that amateurs do not understand well. Even if you install python, if you do not specify where the installed program is, you will not know where you went and you will have trouble running it.

  1. Create a configuration file It seems that the setting contents of PATH are described in .bash_profile, but since it may not be a new MAC, I will make it. Check with cd or ls and create with $ touch .bash_profile. The location is directly under the user's folder. (Reference) http://motomichi-works.hatenablog.com/entry/2016/03/02/103207 As a caveat, it is necessary to display it because it is not normally seen from the Finder. [Inforati, a hidden technique to show hidden files and folders with Mac keyboard shortcuts](http://inforati.jp/apple/mac-tips-techniques/system-hints/how-to-show-hidden-file- in-open-save-dialog-in-mac-os-easily.html)
  2. PATH setting It seems that there are two types of schools below, although it seems to be where to create python itself (because the program language is also a program) and library folders. The upper one is closer to the official explanation, but the lower one may be more suitable for experts as the original directory structure of linux. It feels like it's lined up with the various files that are set by default in the mac, so I interpret it as a professional craftsman's feeling that the tools are lined up all over. Certainly, at the top, it feels like you shouldn't create a folder at the top of My Documents. If you do not set the PATH, you will get an error later.

.bash_profile


export PYENV_ROOT=$HOME/.pyenv
export PATH=$PYENV_ROOT/bin:$PATH
val "$(pyenv init -)"

.bash_profile


if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
export PYENV_ROOT=/usr/local/var/pyenv
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi

Introduction of python

$ pyenv install (The version you want to include)

Introducing the library

Use pip.

Recommended Posts

Creating amateur python environment settings (for MAC)
Python environment construction For Mac
Summary of python environment settings for myself [mac] [ubuntu]
Emacs settings for Python development environment
Python3 TensorFlow for Mac environment construction
python environment settings
[Mac] Building a virtual environment for Python
Mac environment construction Python
Python environment for projects
Building an environment for executing Python scripts (for mac)
Commands for creating a python3 environment with virtualenv
Procedure for creating a Python quarantine environment (venv environment)
A memo for creating a python environment by a beginner
Things to watch out for when creating a Python environment on a Mac
Set Up for Mac (Python)
Python3 environment construction (for beginners)
Python 3 series installation for mac
[For organizing] Python development environment
Building a Python environment for programming beginners (Mac OS)
Ansible environment construction For Mac
[Python] PyCharm environment settings (installation, interpreter settings, addition of packages) Mac environment
Machine learning environment settings based on Python 3 on Mac (coexistence with Python 2)
Create a virtual environment for python on mac [Very easy]
Building a Python environment on Mac
Snippet settings for python jupyter notebook
Error when building mac python environment
Studying Python Part.1 Creating an environment
Create a Python environment on Mac (2017/4)
I checked Mac Python environment construction
Python environment construction memo on Mac
Python development environment options for May 2020
Environment construction of python3.8 on mac
Initial settings for Mac (for data analysts)
Competitive programming with python Local environment settings
Build an environment for Blender built-in Python
Solution for pip install error [Python] [Mac]
Note when creating an environment with python
Create a python environment on your Mac
Let's create a virtual environment for Python
How to prepare Python development environment [Mac]
Creating a python virtual environment on Windows
Build Python environment with Anaconda on Mac
Prepare the development environment for keyhac for Mac
Building a Python development environment for AI development
Creating a development environment for machine learning
[Definitive Edition] Building an environment for learning "machine learning" using Python on Mac
2016-10-30 else for Python3> for:
Template for creating command line applications in Python
Python3 TensorFlow environment construction (Mac and pyenv virtualenv)
Selenium + WebDriver (Chrome) + Python | Building environment for scraping
Ubuntu18.04.05 Creating a python virtual environment in LTS
I want to create a nice Python development environment for my new Mac
Python environment construction
Python explosive environment construction starting from zero (Mac)
python windows environment
How to build an environment for using multiple versions of Python on Mac
Building an Anaconda environment for Python with pyenv
Build a Python environment on Mac (Mountain Lion)
Environment construction (python)
Procedure for creating a LineBot made with Python
Python environment settings (virtualenv + pip cannot be done)