Python installation and package management with pip

Update 2016/8/5 Rewritten to python installation @Windows in 2 lines.


setting a goal

y__sama If you add anaconda, you can enter all of this area. All are available in 64-bit version

Python environment construction for those who aim to become data scientists 2016 If you look around ↑, it's perfect

~~ Using Numpy and Matplotlib with Python (Windows) --Gobble up pudding says that 32bit is better Is it improving now? ~~

~~ Apparently, the official side is tired of rebuilding to the 64-bit version, and officially there is only the 32-bit version. Volunteers have made it a 64-bit version, including the package. ~~

environment

chocolatey installation

Install from the command line with chocolatey (https://chocolatey.org/) in a modern way

  1. Open cmd with administrator privileges
  2. Paste the following, execute it, yesyes yes ... (Does -y make everything yes?)
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

anaconda (Added on 2016/7/23)

It seems that there is something called anaconda that includes not only python itself but also frequently used convenient modules. Thank you to y__sama for teaching me. You can save the trouble of building an environment at once.

~~ When installing with chocolatey, only miniconda can be found ... ~~ It seems that Anaconda was also delivered from June 2016! Install Anaconda with chocolatey

~~ ** I dropped the exe that installs the full version. This is the easiest ** ~~ The state of python got messed up, so I uninstalled it and reinstalled it with chocolatey → Install python in 2 lines @Windows

  1. choco install miniconda3

What is miniconda ... If you don't have time or disk space for the entire distribution, try Miniconda. which contains only conda and Python. Then install just the individual packages you want through the conda command.

Unlike anaconda, it seems that you drop the package yourself. It seems that the size of anaconda after deployment will eventually be 2 to 3 GByte on CentOS and 3 to 4 GByte on Windows, so if you suddenly say that such capacity, miniconda may be fine.

To install additional packages on Anaconda, either (1) use the "conda install" command, or (2) use "setup.py" included in the files of the package you want to install to "python setup.py". There are three ways to do this: run the "install" command or (3) use the pip command.

  1. Execute "conda update conda"
  2. Run "conda update anaconda"
  3. Execute "conda install package_name". Replace package_name with the name of the package you want to install.
  4. If the above command says "Package not found", try the pip command.
  5. Run "pip install package_name"
  6. If you still get "Package not found", download the package source code
  7. Unzip (decompress) the downloaded source code
  8. Move to the folder (directory) where setup.py can be seen
  9. Run "python setup.py install"
  10. If all goes wrong so far, it's possible that it simply doesn't match the version of Python the package is installed on, unless you need to build it.

Please refer to the reference page in the "Reference" section at the bottom of this page. If you have anaconda, the following steps are completely useless! (゜ ω ゜)

Python3.5 64bit installation

If windows 64bit, it will be automatically recognized and 64bit python will be installed (it seems)

  1. Open cmd with administrator privileges
  2. choco install python

(There is also an installer for those who do not want to use chocolatey) (python 3.5.1 64bit install(http://www.filehorse.com/download-python-64/))

pip installation and upgrade

python package management tool First, make sure it is not installed with python. I think it's in a folder called Script in the directory where python.exe is. Imadoki, package installation is usually from the command line

  1. Open cmd with administrator privileges
  2. choco install pip
  3. Check the version with pip -V or pip --version and upgrade if it is 8.1.0 or earlier (how to do it is described in 4)
  4. pip install -U pip or pip install --upgrade pip

Needless to say, use two hyphens when connecting two or more characters as an option. If you want to take the acronym and abbreviate it to one letter, upgrade => U and "-U" is enough.

Install ipython, pyreadline

ipython seems to be an enhanced shell of interactive python. If you want to use interactive python in your favorite terminal without using IDLE, you should put it in. pyreadline is required when using ipython

  1. Open cmd
  2. pip install ipython
  3. pip install pyreadline

wheel installation

I want to install numpy, scipy, matplotlib as well, but I get stuck from pip.

libraries lapack not found in ['C:\\Users\\U1and0\\AppData\\Local\\Programs\\Python\\Python35\\lib', 'C:\\', 'C:\\Users\\U1and0\\AppData\\Local\\Programs\\Python\\Python35\\libs']
NOT AVAILABLE

There were a lot of things like that, but I didn't really understand. I arrived at .whl, download it, and pip it. Before that, you need to install something called wheel. (Wheel is a distribution format of python package. I don't know if the 64-bit version isn't official because it can't be simply installed with pip like ipython, or if I've skipped steps without knowing anything. )

  1. pip install wheel

Now you can create a whl format file or unzip and install it.

Install numpy, scipy, matplotlib

Download the .whl file of your favorite package from Unofficial Package Storage For example, download numpy-1.10.4 + mkl-cp35-cp35m-win_amd64.whl (unlike the other three, this one is only 123MB)

  1. Jump to http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
  2. Download numpy-1.10.4 + mkl-cp35-cp35m-win_amd64.whl
  3. Open cmd
  4. cd <2 file download directory>
  5. pip install numpy-1.10.4+mkl-cp35-cp35m-win_amd64.whl

Check if it was installed properly

Quick to ask package manager pip

  1. Name and version information list with pip list or pip freeze

If you are still uneasy, import each package and ask for version information.

  1. Start python
  2. import numpy
  3. numpy.version.version

Since matplotlib does not have a version, if you type in python as follows and Gauss distribution appears, it is installed

gaussian.py


import numpy as np
from matplotlib import pyplot as plt
mean = 0
var = 1
x = np.arange(-5., 5., 0.001)
y = (1./np.sqrt(2 * np.pi * var) * np.exp(-(x - mean)**2 / 2 / var))
plt.plot(x, y)
plt.show()

reference

Installing numpy, scipy, matlib with pip http://hennohito.cocolog-nifty.com/blog/2014/04/python34-64-b-1.html Unofficial package collection http://www.lfd.uci.edu/~gohlke/pythonlibs/ When installing python, 32bit or 64bit is better ... http://fa11enprince.hatenablog.com/entry/2014/12/07/135713 The python package you want to include http://rinor.hatenablog.com/entry/2015/07/11/105210 Installation of anaconda full version https://www.continuum.io/downloads anaconda installation instructions) Japanese http://morimori2008.web.fc2.com/contents/PCprograming/python/pythonAnaconda.html List of packages included in anaconda http://docs.continuum.io/anaconda/pkg-docs

Recommended Posts

Python installation and package management with pip
About package management with conda and pip
Install Python 2.7.9 and Python 3.4.x with pip.
[Package management] Installation destination and internal processing of apt and pip
Install Python package management tool pip (Windows)
PIL installation with pip
[Python] pip and wheel
Programming with Python and Tkinter
Encryption and decryption with Python
Python and hardware-Using RS232C with Python-
YouTube video management with Python 3
Python installation and basic grammar
[GUI with Python] PyQt5-Layout management-
Start numerical calculation in Python (with Homebrew and pip)
python package dependencies and virtual environment management tool Poetry
python with pyenv and venv
Dealing with pip and related installation errors on Ubuntu 18.04
Password management with python: keyring
Source installation and installation of Python
Python (Python 3.7.7) installation and basic grammar
Works with Python and R
[Python] Anaconda environment construction (installation, startup, virtual environment, package management) Mac environment
I tried follow management with Twitter API and Python (easy)
Installation procedure for Python and Ansible with a specific version
Package python runtime and pypi library with chef / omnibus and Docker
Module summary that automates and assists WebDriver installation with Python
Communicate with FX-5204PS with Python and PyUSB
Shining life with Python and OpenCV
[Package cloud] Manage python packages with package cloud
Robot running with Arduino and python
Neural network with OpenCV 3 and Python 3
AM modulation and demodulation with python
Installation of SciPy and matplotlib (Python)
[Python] font family and font with matplotlib
Scraping with Node, Ruby and Python
Scraping with Python, Selenium and Chromedriver
Scraping with Python and Beautiful Soup
Command installation destination with pip, easy_install
JSON encoding and decoding with python
Hadoop introduction and MapReduce with Python
[GUI with Python] PyQt5-Drag and drop-
Python package management tool personal summary
Visualize python package dependencies with graphviz
Reading and writing NetCDF with Python
I played with PyQt5 and Python3
Reading and writing CSV with Python
Multiple integrals with Python and Sympy
Coexistence of Python2 and 3 with CircleCI (1.0)
Easy modeling with Blender and Python
Sugoroku game and addition game with python
FM modulation and demodulation with Python
[Python Windows] pip install with Python version
Python installation
pip installation
How to deal with errors when installing Python and pip with choco
Install pip in Serverless Framework and AWS Lambda with Python environment
Python installation
pip installation
pip installation
Installation of Visual studio code and installation of python
Communicate between Elixir and Python with gRPC