Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build python3 environment in centos7 system

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to build python3 environment in centos7 system? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

What can python do Python is a programming language, built in many effective tools, Python is almost omnipotent, the language is easy to understand, easy to start, powerful, in many fields, such as the most popular big data analysis, artificial intelligence, Web development and so on.

1. After installing the virtual machine, add the image file and select minimal to minimize installation

Yum update# update software yum-y install gcc kernel-devel kenel-headers make bzip2 # install dependent library reboot # restart

two。 Mount the execution script

Mount / dev/cdrom / mnt # Mount the CD drive to the mnt directory cd / mnt # go to the mnt directory sh. / VBoxLinuxAdditions.run # execute the script to install reboot # restart

3. Take a snapshot for later recovery

Installation of 4.python environment (installation of pyenv)

Configuration of centos

$yum install readline readline-devel readline-static-y $yum install openssl openssl-devel openssl-static-y $yum install sqlite-devel-y $yum install bzip2-devel bzip2-libs-y $yum install patch vim git

Install python3.3/pip3

# install python3.3$ sudo mkdir / usr/local/python3 # create installation directory $wget-- no-check-certificate https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz # download the source file. Note: when wget acquires https, add:-- no-check-certificate$ tar-xzvf Python-3.6.0.tgz # unzipped package $cd Python-3.6.0 # enter the unzipped directory # compile and install $sudo. / configure-- prefix=/usr/local/python3 # specify the directory created $sudo make$ sudo make install# configuration two versions coexist $sudo ln-s / usr/local/python3/bin/python3 / usr/bin/python3 # create a soft link for python3 This makes it possible to use Python 3 with the python command using Python 2 and python 3. # Modification defaults to Python 3$ sudo mv python python.bak $sudo ln-s / usr/local/python3/bin/python3 / usr/bin/python # to create a soft link for python3 $sudo vi / usr/bin/yum # because yum uses Python 2, so it may not work properly after replacing it with Python 3, so modify the yum configuration file. Change the python version specified in the first line to python2.7 (#! / usr/bin/python to #! / usr/bin/python2.7) # Source code installation pip$ wget-- no-check-certificate https://github.com/pypa/pip/archive/9.0.1.tar.gz# download source code $tar-zvxf 9.0.1-C pip-9.0.1 # extract file $cd pip-9.0.1 $python3 setup.py Install# uses Python 3 to install $sudo ln-s / usr/local/python3/bin/pip / usr/bin/pip3 # to create a link $pip install-- upgrade pip # upgrade pip

Install setuptools

Tar-xvf setuptools-1.4.2.tar.gzcd setuptools-1.4.2python setup.py install after reading the above, have you mastered how to build a python3 environment in the centos7 system? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report