Before using Python, the root user installed the global Python, now, because the root user installed a Python version is too low, and do not have root privileges to upgrade the global Python, So you want to install your own specified python under a non-root user. As a result, a copy of how to install Python and its associated libraries in a Linux environment with non-root users is available for a rainy day.
Install Python
Python repository https://www.python.org/ftp/python/, here I choose the 2.7.5 version, when installing Python, use the --prefix
specified installation path, the command is as follows:
wget https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgztar -xzf Python-2.7.5.tgzcd Python-2.7.5mkdir -p /home/liudiwei/software/python27 ./configure --prefix="/home/liudiwei/software/python27"makemake install
Installing Setuptools
Setuptools is mainly for the installation of PIP, the following is a download to the installation of all commands, using the specified path installed above the Python /home/liudiwei/software/python27/bin/python
installation:
wget --no-check-certificate http://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.tar.gztar -xzvf setuptools-2.0.tar.gzcd setuptools-2.0/home/liudiwei/software/python27/bin/python setup.py install
Install PIP
Using PIP to install a Python-related library is easy, with Python replaced with Python python setup.py install
under the specified path you installed /home/liudiwei/software/python27/bin/python setup.py install
.
wget --no-check-certificate https://pypi.python.org/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/pip-8.1.1.tar.gz#md5=6b86f11841e89c8241d689956ba99ed7tar -xzf pip-8.1.1.tar.gzcd pip-8.1.1/home/liudiwei/software/python27/bin/python setup.py install
Install related libraries
Under the bin path to the Python installation directory, install the following libraries, which are tested for installation.
- Simplejson
- Redis
- NumPy
- SciPy
- Sklearn
installation command:
installinstallinstallinstallinstall sklearn
About the installation of matplotlib, because the system is not installed due to some dependencies matplotlib installation failure, such as libpng, FreeType, etc., to be completed after the installation, and then to improve.
Installation of Python and related libraries by non-root users in Linux environments