Environment: Debian 8.8 64-bit, also suitable for win10
The basic steps:
1. Install Python
Continue to build a Python environment and choose a compromise version Python 3.4
sudo apt-get install python3
At this time, there will be a problem: how to use pip when both Python3 and Python2 are installed? The default installed pip corresponds to python 2.7
Use the simplest and most straightforward solution:
apt-get purge -y python3-pip apt-get install python3-pip
Check if it is installed:
root@xkfx:/opt/python# python3 -m pip -V pip 1.5.6 from /usr/lib/python3/dist-packages (python 3.4)
Update to the latest version:
python3 -m pip install --upgrade pip
To install the module to the corresponding Python version with pip (specify the Python version):
python3 -m pip install module name
PS. -m is probably the meaning of the module module
2. Install the necessary libraries
ipython:
root@xkfx:~# python3 -m pip install ipython root@xkfx:/opt/python# ipython Python 3.4.2 (default, Oct 8 2014, 10:45:20) Type 'copyright', 'credits' or 'license' for more information IPython 6.3.1 -- An enhanced Interactive Python. Type '?' for help. In [1]: exit
matplotlib :
root@xkfx:~# python3 -m pip install matplotlib root@xkfx:~# python3 Python 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import xxxxxx Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'xxxxxx' >>> import matplotlib
numpy:
root@xkfx:~# python3 -m pip install numpy Looking in indexes: http://mirrors.aliyun.com/pypi/simple/ Requirement already satisfied: numpy in /usr/local/lib/python3.4/dist-packages (1.14.2) root@xkfx:~# python3 Python 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numpy
sklearn :
root@xkfx:~# python3 -m pip install scipy root@xkfx:~# python3 -m pip install sklearn root@xkfx:~# python3 Python 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sklearn
tensorflow:
root@xkfx:~# python3 -m pip install tensorflow root@xkfx:~# python3 Python 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow as tf >>> print(tf.__version__) 1.7.0
pandas:
python3 -m pip install pandas Command "/usr/bin/python3 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-kfazvlty http://mirrors.aliyun.com/pypi/packages/1b/d2/22cde5ea9af055f81814f9f2545f5ed8a053eb749c08d186b369959189a8/wheel-0.31.0-py2.py3-none-any.whl#md5=240d714477a715bcd90e94cb2c44f28c http://mirrors.aliyun.com/pypi/packages/20/d7/04a0b689d3035143e2ff288f4b9ee4bf6ed80585cc121c90bfd85a1a8c2e/setuptools-39.0.1-py2.py3-none-any.whl#md5=ca299c7acd13a72e1171a3697f2b99bc http://mirrors.aliyun.com/pypi/packages/70/25/1e1521e6ce2cf78ff4a8b06fbc2cd513ce004ec337000eddfe016fdf3fc6/Cython-0.28.2-cp34-cp34m-manylinux1_x86_64.whl#md5=e277ba5fdbbaab6e3434bdcf58e41d6a http://mirrors.aliyun.com/pypi/packages/fc/1b/a1717502572587c724858862fd9b98a66105f3a3443225bda9a1bd16ee14/numpy-1.9.3-cp34-cp34m-manylinux1_x86_64.whl#md5=e1130c8f540a759d79ba5e8960f6915a http://mirrors.aliyun.com/pypi/packages/02/64/c6c1c24ff4dbcd789fcfdb782e343ac23c074f6b8b03e818ff60eb0f937f/numpy-1.12.1-cp34-cp34m-manylinux1_x86_64.whl#md5=6288d4e9cfea859e03dc82879539d029 http://mirrors.aliyun.com/pypi/packages/1b/ee/f65826b2880f67652c21326565b4c166c7cdb1019f84b82af65e625475cd/numpy-1.13.1-cp34-cp34m-manylinux1_x86_64.whl#md5=c51520d0d3836c91cba18d1fa8cf299c" failed with error code 1 in None
Since pandas was not successfully installed anyway under debian
I finally decided to build the environment on windows. . .
3. Test
Run the following code, and it will be ok if there is no error.
import math from IPython import display from matplotlib import cm from matplotlib import gridspec from matplotlib import pyplot as plt import numpy as np import pandas as pd from sklearn import metrics import tensorflow as tf from tensorflow.python.data import Dataset tf.logging.set_verbosity(tf.logging.ERROR) pd.options.display.max_rows = 10 pd.options.display.float_format = '{:.1f}'.format