2019-04-09: Python environment construction and data modeling third-party library installation

# 1. python installation
Installation method 1: install through the official website.
Under win10 64-bit operating system, install python process: download the corresponding installation package from the official website (installation package address: https://www.python.org/downloads/windows/), find the corresponding installation tutorial on the Internet, and install it according to the steps.

 

Installation method 2: Install through anaconda, the advantage is that it is convenient to manage the environment.
step1: Download the anaconda installation package from the official website, address: https://www.anaconda.com/distribution/
step2: After the installation is successful, configure the environment variables. Search the installation and configuration tutorials online.
setp3: Open the anaconda prompt when installing the library, create an environment, and then install the corresponding library.

 

Environment creation, viewing and other commands are as follows:
Switch environment: activate ***
New environment: conda create -n ***
Delete environment: conda remove -n *** --all
Copy environment: conda create -n newEnv --clone oldEnv
View the current environment: conda info --envs
install different versions of Python: conda create -n *** python=3
log out of the environment and return to the previous state: deactivate
find the package: conda search ***
install the package: conda install --name * **
Check package: conda list
remove package: conda remove -n (environment name) (package name)
! [Insert picture description here](https://img-blog.csdnimg.cn/20190725101127492.png?x- oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl8zODE5MjI1NA==,size_16,color_FFFFFF,t_70)

 

# 2. Third-party function library installation

pip --default-timeout=100 install -U numpy
pip --default-timeout=100 install -U TensorFlow

Third-party library installation: online installation, offline installation.

 

## Installation method 1: Conda or pip online installation.
Open the terminal (the built-in shell or anaconda prompt), and complete the installation online through the pip or conda command.

 

Note: You cannot enter the python environment during installation.

 

Example: To install the pandas library, enter "pip install pandas".

pip --default-timeout=100 install -U numpy
pip --default-timeout=100 install -U TensorFlow

(1) Libraries used for data analysis and modeling: numpy, pandas, matplotlib, scikit-learn and theano.

 

(2) Deep learning framework TensorFlow installation: win10, 64-bit, cup version installation, use pip command:
```python
pip --default-timeout=100 install -U numpy
pip --default-timeout=100 install -U TensorFlow
```
Note: Because the library source used for pip installation and connection is a foreign website, when the Internet speed is slow, a "timeout" error, that is, a download failure, will appear. Use the relevant command to make the time to read the download longer, and you can fix the error . In addition, numpy needs to be upgraded to version 1.16 (pro-test), version 1.15 will report a "version incompatible" error. The entire process of installing TensorFlow is time-consuming and cost-intensive, mainly due to slow internet speed. The test installation is successful, just use the following program to test:
```python
import TensorFlow as tl
hello=tf.constant('hello world')
sess=tf.Session()
print(sess.run(hello))
```

 

## Installation method 2: Offline installation.

 

Download the wheel installation package file corresponding to the library, use the cd command in the terminal to switch to the path where the installation package is located, and use the pip or conda command to install. The command is "pip install filename", where filename is the name of the wheel file.

 

Note: In general, pip can install most of the third-party libraries, and the ones that cannot be installed can basically be solved by offline installation.

 

 

Guess you like

Origin blog.csdn.net/weixin_38192254/article/details/98505745