[Python3] Development environment construction << Windows edition >>

Introduction

We have summarized the development environment construction when using Python on Windows.

System configuration

Virtual environment (venv)

By using a virtual environment, you can manage Python packages for each virtual environment.

  • Up to Python 3.4, ** pyvenv ** was recommended, but as of Python 3.8, venv ** is recommended. ( pyvenv ** is deprecated from Python 3.6)

Create

PowerShell


# python -m venv Environment name to be created
python -m venv venv

--Execute at the project root (application root)

activation

PowerShell


.\venv\Scripts\activate
* When PSSecurityException occurs *

powershell.png The default execution policy of PowerShell restricts script execution of external files, so it is necessary to change the execution policy.

# -Scope Process :Apply only current process execution policy
Set-ExecutionPolicy -Scope Process RemoteSigned

Invalidation

PowerShell


deactivate

Package management (pip)

Use pip (installer program) to manage PyPI (The Python Package Index) packages.

Installation

PowerShell


#pip install package name
pip install black

#pip install package name==version
pip install black==19.3b0

Uninstall

PowerShell


#pip uninstall package name
pip uninstall black

Package List

PowerShell


#View list of installed packages
pip list

#Output of installed package list
pip freeze > requirements.txt

#Bulk installation from the package list
pip install -r requirements.txt
* Notes on outputting files with PowerShell *

When redirect (>) is used in PowerShell, the character code of the output file is "UTF-16 LE". In order to output a file with "UTF-8", it is necessary to use the following cmdlet.

pip freeze | Out-File -Encoding utf8 requirements.txt

Recommended Posts

[Python3] Development environment construction << Windows edition >>
python windows environment construction
Python development environment construction
python2.7 development environment construction
Windows + gVim + Poetry python development environment construction
Python environment construction (Windows10 + Emacs)
CI environment construction ~ Python edition ~
Python environment construction under Windows7 environment
[MEMO] [Development environment construction] Python
Python environment construction memo on Windows 10
Anaconda python environment construction on Windows 10
Python environment construction
Environment construction (python)
Python development environment construction on macOS
python environment construction
Python --Environment construction
Python environment construction
Install Python development environment on Windows 10
Emacs Python development environment construction memo
python environment construction
Python (anaconda) development environment construction procedure (SpringToolsSuites) _2020.4
Python project environment construction procedure (for windows)
Python3 + venv + VSCode + macOS development environment construction
VScode environment construction (Windows10, Python, C ++, C, Git)
About Python development environment
Development environment in Python
Mac environment construction Python
Python environment construction @ Win7
Python environment construction (Anaconda + VSCode) @ Windows10 [January 2020 version]
Create a Python virtual development environment on Windows
Python + Anaconda + Pycharm environment construction
Django development environment construction memo
Python + Kivy development on Windows
Python environment construction For Mac
Anaconda3 python environment construction procedure
Build Python environment on Windows
Python3 environment construction (for beginners)
Organize your Python development environment
Python environment construction and TensorFlow
Django environment development on Windows 10
[ev3dev × Python] Build ev3dev development environment
Build python environment on windows
[For organizing] Python development environment
[Tensorflow] Tensorflow environment construction on Windows 10
Environment construction, Build -Go edition-
django project development environment construction
Environment construction of python2 & 3 (OSX)
[MEMO] [Development environment construction] wine
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
Create a comfortable Python 3 (Anaconda) development environment on windows
Build a GVim-based Python development environment on Windows 10 (1) Installation
Google App Engine / Python development environment construction procedure (late 2014)
Python development environment with Windows + Anaconda3 + Visual Studio Code
Python development environment construction 2020 [From Python installation to poetry introduction]
QGIS3 Python plugin development environment construction with VSCode (macOS)
Python development environment with Windows + Python + PipEnv + Visual Studio Code
OpenJTalk on Windows10 (Speak Japanese with Python from environment construction)
Get started with Python! ~ ① Environment construction ~
Prepare Python development environment on Ubuntu
Python + Unity Reinforcement learning environment construction
Install python2.7 on windows 32bit environment