添加文章

This commit is contained in:
赵鑫 2022-09-03 13:28:20 +08:00
parent 59bde7ef81
commit 3a9f062cfe
4 changed files with 108 additions and 1 deletions

View File

@ -39,7 +39,7 @@ external_link:
enable: true # Open external links in new tab
field: site # Apply to the whole site
exclude: ''
filename_case: 1
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false

View File

@ -0,0 +1,51 @@
---
title: Linux 登录时显示的信息是什么
sitemap: true
keywords: [Linux,mtod]
categories: [Arch Linux]
tags: [Linux,mtod]
date: 2022-09-03 12:50:34
---
登录 Linux 后,终端可能显示一堆文字,不同的 Linux 发行版显示的可能有所不同。
其中可能包括 Linux 版本信息、上次登录的信息、系统其它信息等。
通常 `/etc/motd` 文件中的文字将被显示。`motd` 是 `message of the day` (今日消息) 的缩写,其本意就是以一种廉价的方式为每位登录的用户显示一些消息。依据 `man` 中的描述,`/etc/motd` 是 `/var/run/motd` 的软链接。另外,`/etc/motd.tail` 是创建“今日消息”的模板。
树莓派自带的系统是 debian 的分支,可以在 `/etc/update-motd.d/` 路径中存放脚本,并会在用户登录后被执行,以显示一些更丰富动态的登录信息。
``` sh
xin@pi /e/update-motd.d ls
.rwxr-xr-x 23 root root 2022-09-02 19:38 10-uname*
.rwxr-xr-x 702 root root 2022-09-02 20:51 20-raspberrypi*
xin@pi /e/update-motd.d cat 10-uname
#!/bin/sh
uname -snrvm
xin@pi /e/update-motd.d cat 20-raspberrypi
#!/bin/sh
export force_color_prompt=yes
export TERM=xterm-256color
echo "$(tput setaf 2)
.~~. .~~.
'. \ ' ' / .'$(tput setaf 1)
.~ .~~~..~. $(tput sgr0) _ _ $(tput setaf 1)
: .~.'~'.~. : $(tput sgr0) ___ ___ ___ ___| |_ ___ ___ ___ _ _ ___|_|$(tput setaf 1)
~ ( ) ( ) ~ $(tput sgr0) | _| .'|_ -| . | . | -_| _| _| | | | . | |$(tput setaf 1)
( : '~'.~.'~' : ) $(tput sgr0) |_| |__,|___| _|___|___|_| |_| |_ | | _|_|$(tput setaf 1)
~ .~ ( ) ~. ~ $(tput sgr0) |_| |___| |_| $(tput setaf 1)
( : '~' : )
'~ .~~~. ~'
'~'
$(tput sgr0)"
```
我清空了 `/etc/motd` 的内容,并添加了 `/etc/update-motd.d/20-raspberrypi`,登录树莓派时的显示效果如下:
![](images/ssh_the_pi.png)
另外,如果登录时不想看见所有这些,可以在所登录的用户家目录中创建一个叫 `.hushlogin` 的文件。
``` sh
touch ~/.hushlogin
```

View File

@ -0,0 +1,56 @@
---
title: Pyhton 环境搭建
sitemap: true
keywords: [Python]
categories: [Python]
tags: [Python]
date: 2022-09-03 12:13:10
---
# 安装 Python
只有 Windows 用户需要注意一点,用安装程序安装时一定要记得勾选 `Add Python to PATH`
# pip
Python 包管理器 pip 的配置文件在 `$HOME/.config/pip/pip.conf`
执行以下语句,可以为当前用户设置 pypi 安装源:
``` sh
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
```
执行完毕后,`pip.conf` 中会添加如下设置:
``` conf pip.conf
[global]
index-url = https://mirrors.ustc.edu.cn/pypi/web/simple
```
pip 常用的命令:
``` sh
pip install <package> --user # 为当前用户安装指定的包
pip list --user # 列出为当前用户安装的包
pip show <package> # 显示指定包的详情
pip install <package> --upgrade # 升级指定的包,或可用短参数-U
```
当前用户安装的包保存在 `$HOME/.local/lib/python3.xx/site-packages` 中。
# pipenv
一个 Python 虚拟环境管理器,安装方法 `pip install pipenv --user`
添加将以下环境参数pipenv 就可以在当前路径中创建 Python 虚拟环境了:
``` conf env
PIPENV_VENV_IN_PROJECT=enabled
PIPENV_IGNORE_VIRTUALENVS=1
PIPENV_VERBOSITY=-1
```
# vscode
在 VS Code 中的配置 Python 开发环境,待续...

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB