# Python Development Environment
## pyenv
* install
```
# Centos
yum install gcc zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel git
```
```
# Ubuntu
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
```
```
$ curl https://pyenv.run | bash
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"' >> ~/.bashrc
$ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
```
> ```
> export PYENV_ROOT="$HOME/.pyenv"
> export PATH="$PYENV_ROOT/bin:$PATH"
> eval "$(pyenv init -)"
> eval "$(pyenv virtualenv-init -)"
* install python
```
$ pyenv install -v 3.8.0
# list version
pyenv versions
# switch version
pyenv shell
pyenv local
pyenv global
```
* create virtualenv
```
$ root@ub:~/py-dev/flask# pyenv virtualenv 3.8.0 flask-py3
Looking in links: /tmp/tmpwyg_tk3f
Requirement already satisfied: setuptools in /root/.pyenv/versions/3.8.0/envs/flask-py3/lib/python3.8/site-packages (41.2.0)
Requirement already satisfied: pip in /root/.pyenv/versions/3.8.0/envs/flask-py3/lib/python3.8/site-packages (19.2.3)
$ root@ub:~/py-dev/flask# pyenv local flask-py3
```
## VSCode
### Settings
* Global
* Remote
* Workspace
```json=
"editor.fontSize": 16,
"editor.fontFamily": "'Source Code Pro', Consolas",
"editor.lineHeight": 24,
"editor.renderWhitespace": "all",
"workbench.colorTheme": "(Actual) Obsidian",
"workbench.iconTheme": "vscode-icons",
"workbench.startupEditor": "newUntitledFile",
```
### Extensions
* Chinese (Traditional) Language Pack for Visual Studio Code
* Python
```json
"python.formatting.provider": "yapf",
"python.linting.pylintEnabled": true,
"python.linting.pycodestyleEnabled": true,
"python.linting.pycodestyleArgs": [
"--ignore=E501"
],
```
* Remote Development
https://hackmd.io/@brick9450/vscode-remote
```
Host my_server
HostName 10.102.40.27
User root
IdentityFile C:\Users\username\.ssh\id_rsa
```
* GitLens
* Bracket Pair Colorizer
* Trailing Spaces