Install Python on Windows + pip + virtualenv

When you're in a development environment, you often suffer from differences in installed libraries. Furthermore, since Python 2.x series and Python 3.x series may be in parallel, virtualenv should be used to manage the environment.

Python

Installation

  1. Get the installer Download the Python binary for Windows (Python 2.7.x) from the Python site.
  2. Double-click the installer to run
  3. Next
    03.png
  4. Specify the installation destination Next
    04.png
  5. Next
    05.png
  6. Installation
    06.png
  7. Finish
    07.png

Creating a Python execution bat file

Create a batch file that registers environment variables for running python. To run python, double-click this batch file to launch a command prompt.

python27.bat


@echo off
:::Preparation before execution
set EXEC_DIR=%~dp0

::: python
PATH=C:\usr\local\bin\Python27;C:\usr\local\bin\Python27\Scripts;%PATH%

cd %EXEC_DIR%
PROMPT #$S

%ComSpec%

pip installation

  1. Save get-pip.py as
  2. Run get-pip.py
# python get-pip.py

Get-pip.py is not needed after execution, so delete it

virtualenv installation

# pip install virtualenv

How to use virtualenv

Usage: python -m virtualenv ${Folder where you want to create a virtual environment}

Create a virtual environment called "hoge" and start / end

Creating a virtual environment (Python 2.7)

# python -m virtualenv --python=C:\usr\local\bin\Python27\python.exe hoge
Already using interpreter C:\usr\local\bin\Python27\python.exe
New python executable in hoge\Scripts\python.exe
Installing setuptools, pip...done.

#

Start virtual environment

# hoge\Scripts\activate
(hoge) #

End of virtual environment

(hoge) # hoge\Scripts\deactivate
#

Recommended Posts

Install Python on Windows + pip + virtualenv
Install python on windows
Install Numpy on virtualenv on Windows
Set-enable Python virtualenv on Windows
Install watchdog on Windows + Python 3.3
[Python] [Chainer] [Windows] Install Chainer on Windows
Install ZIP version Python and pip on Windows 10
Pip install --ugrade pip fails on Windows
Python on Windows
Install python2.7 on windows 32bit environment
Install xgboost (python version) on Windows
Install Pytorch on Blender 2.90 python on Windows
Install Python development environment on Windows 10
[Python Windows] pip install with Python version
Install easy_install and pip on windows
Install python3 and scientific calculation library on Ubuntu (virtualenv + pip)
[Kivy] How to install Kivy on Windows [Python]
Virtualenv does not work on Python3.5 (Windows)
Install Python package management tool pip (Windows)
scipy stumbles with pip install on python 2.7.8
Install python on xserver to use pip
Install Python 3.8, Pip 3.8 on EC2 (Amazon Linux 2)
Install python on WSL
Install pip on Mavericks
Install Python on Pidora.
Install Scrapy on python3
Install Python on Mac
Install Python 3 on Mac
Install Python3.4 on CentOS 6.6
Install Anaconda on Windows 10
python basic on windows ②
Install pycuda on Windows10
Install Python 2.7.3 on CentOS 5.4
Install pygraphviz on Windows 10
Install Python 3.3 on Ubuntu 12.04
Install Chainer 1.5.0 on Windows
Install Python 3.4 on Mac
Use pip on Windows
Install pip / pip3 on Ubuntu
Install Python 3.6 on Docker
Install Python (for Windows)
Install and run Python3.5 + NumPy + SciPy on Windows 10
Install Python3, numpy, pandas, matplotlib, etc. on Windows
Notes on installing Python3 and using pip on Windows7
Install OpenCV 4.0 and Python 3.7 on Windows 10 with Anaconda
Run pip install on MacOS Python 3.7 or later
[Python] How to install OpenCV on Anaconda [Windows]
Eliminates SSL error when PIP Install on Windows.
Run Openpose on Python (Windows)
Install Python 3.8 on RHEL 8 (AppStream)
Install Python and Flask (Windows 10)
Install Win-Kex (kali-linux) on Windows 10.
Install pygame on python3.4 on mac
Windows10: Install python dlib library
Install cvxpy on windows, Anaconda
Python + Kivy development on Windows
Install Python 3.8 on CentOS 7 (SCL)
Sphinx-autobuild (0.5.2) on Windows7, Python 3.5.1, Sphinx 1.3.5
Install pyqt4 under virtualenv (Windows)
Fastest Python installation on Windows
Build Python environment on Windows