Ubuntu user switch, configure Python development environment and required third-party libraries

1. User switching

Switch from normal user to root user

After logging in to ubuntu, press the key combination CTRL+ALT+T to enter the terminal interface. Generally, the terminal interface defaults to the normal user permission mode. How to enter the root user from a normal user is as follows:

1. Press su, and then enter the corresponding root password as prompted to log in to root privileges.

2. Press sudo su, and then enter the corresponding root password as prompted, you can log in to the root privilege (under this command, you generally do not need to enter the corresponding root password).

3. Press su root, and then enter the corresponding root password as prompted to log in to root privileges.

 

There are three ways to switch the root user to a normal user:

1. If you want to switch back to the user user from the root user, just execute the command: su user (user is the user name when you installed it yourself),

2. Enter exit directly,

3. Ctrl+D key combination to exit

How to set a password for the root user:

Just execute the command: sudo passwd root and follow the prompts step by step.

Disable and enable root login

Execute sudo passwd -l root (just disable root, but the root password is still saved), and then execute su root to find that the authentication fails, (but the sudo su command can still enter root mode).

To initiate root login again, execute sudo passwd -u root ie.

Installation of the library

When installing third-party libraries, it is best to update the software

sudo apt-get update

bs4 installation

pip install beautifulsoup4

查看安装是否成功

$ pip list 

installation of requests

sudo apt-get install python-requests
出现问题时:apt-get install -f修复

Numpy, scipy installation

Installation details:
1. Install the nose package first.

sudo apt-get install python-nose

I tried to install it with the pip command, sudo pip install nose, but it didn't work, maybe my command was wrong, so I replaced it with the above command, and the installation of nose was successful.
2. Next install various packages.

# 安装gfortran,后面编译过程中会用到
sudo apt-get install gfortran
# 安装blas,Ubuntu下对应的是libopenblas,其它操作系统可能需要安装其它版本的blas——这是个OS相关的。
sudo apt-get install libopenblas-dev
# 安装lapack,Ubuntu下对应的是liblapack-dev,和OS相关。
sudo apt-get install liblapack-dev
# 安装atlas,Ubuntu下对应的是libatlas-base-dev,和OS相关。
sudo apt-get install libatlas-base-dev

3. Install numpy

sudo apt-get install python-numpy

You can test whether numpy is installed successfully, according to the previous method.

4. Install scipy

sudo apt-get install python-scipy

pandas installation

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325443418&siteId=291194637