Python basic installation guide

In order to take care of beginner python students, now we start with python installation!
Not much nonsense! Start directly!

install on window

Python installation package download address: https://www.python.org/downloads/

Look at this boss for a specific tutorial! Very detailed! If you don’t understand, you can contact me!

window installation tutorial

Install on CentOS

Download python3.7.1

Download to /usr/src

wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz -P /usr/src

Unzip

After entering the download file

tar xf Python-3.7.1.tar.xz

Install dependencies

Don't install if there is

yum -y install gcc-* openssl-* libffi-devel sqlite-devel

Profile detection

./configure --with-openssl=/usr/bin/openssl

Compile

make

installation

make install

Upgrade pip3

pip3 install --upgrade pip

Install virtual environment (optional)

Create a python virtual environment for each project, instead of sharing an environment for each project (each environment can install its own plug-in)

pip3 install virtualenv
# 创建环境
virtualenv -p python3 web (环境名叫web)

# 生效环境
source web/bin/activate
'''当命令行前面有web后,说明已经进入虚拟环境'''

Ubuntu python environment

ubuntu comes with python3, it's really fragrant

First, install pip3

sudo apt-get update
sudo apt-get install python3-pip

anacoda build environment

Enter the official website of anaconda3 to find the corresponding version of liunx. Copy the download link

$ wget "下载链接"

Unzip anaconda3

$ bash Anaconda3-5.2.0-Linux-x86_64.sh

Configure anaconda3 environment variables

$ sudo vi /etc/profile
$ export PATH=$PATH:/home/software/anaconda3/bin  / 路径为你安装的anacoda路径
$ source /etc/profile  / 立即生效

Create a specified coda environment

conda create -n py3.7 python=3.7

Switch to the generated environment

source activate py3.7

Batch pip3 install installation

Create a new file requirements and write the modules to be installed

scrapy
scrapy-redis
pymysql
redis>=3.2.1
fake-useragent
pymongo
Pillow

Run on the server

pip3 install -r requirements

Guess you like

Origin blog.csdn.net/weixin_37254196/article/details/108147919