Skip to content

Commit

Permalink
20220905上班备份
Browse files Browse the repository at this point in the history
  • Loading branch information
lvlongxin committed Sep 5, 2022
1 parent dc11c28 commit 56d8ccf
Show file tree
Hide file tree
Showing 5 changed files with 185 additions and 0 deletions.
Empty file added git/git常用命令.md
Empty file.
145 changes: 145 additions & 0 deletions python/多版本python控制.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# 背景

* 在实际使用中,我们可能还想要使用oython2或者python3

* 但是安装好的linux系统通常默认只附带一种python

* 很不巧的是python2和python3是不兼容的

## 更换apt-get源

* 这里用的是ubuntu20.04

* 源文件是/etc/apt/sources.list

* 备份一份,把阿里云和清华源放进去

```
#添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
#添加清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse multiverse
```

* 把源换好之后,进行源更新(更新源软件版本表)

```sudo
sudo apt-get update
```

* 如果出现依赖问题,解决方法如下

```
sudo apt-get -f install
```

* 更新软件(本地软件和源仓库表里面的软件对比版本号,进行升级)

```
sudo apt-get upgrade
```

## 注意点

* ubuntu20.04就想要更换20.04的源仓库地址,不能乱更新,版本号对不上,下载的依赖可能会出问题,(依赖包版本不一样,会找不到相关依赖,服务报错)

* 在Settings里的最后一栏About,最后一栏Software Updates,里面有个Download from,从这里找到中国,然后直接自动测试连接最快的服务器就可以了

## 安装python2

```
apt install python3-pip
```

* 安装完成后我们可以使用如下命令来检查目前可用的 Python 版本:

```
ls /usr/bin/python*
```

可以看到,我可用的 Python 版本有如上几个…

* 设置默认方式(替代版本)

```
sudo update-alternatives --list python
```

若是报错update-alternatives: error: no alternatives for python则说明没有配置默认版本

* 我们设置默认版本

```
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2
```

* 进行切换和xuanz

```
sudo update-alternatives --config python
```

## 安装pip

### python3

* 下载文件进行安装

```
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
```

apt install python3-pip

### python2

* 下载文件进行安装

```
https://bootstrap.pypa.io/pip/2.7/get-pip.py
```

### 安装命令

* 就是使用对应版本的python执行对应get-pip.py文件

### pip换源

```
mkdir ~/.pip
sudo gedit ~/.pip/pip.conf
```

* 文件配置

```
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
```



## 参考

[pip参考链接]([Ubuntu 下安装 pip_搬砖-工人的博客-CSDN博客_ubuntu如何安装pip](https://blog.csdn.net/My_CSDN_IT/article/details/113892209))

[python参考链接]([在 Ubuntu20.04 上安装 python2 并设置为默认方式_搬砖-工人的博客-CSDN博客_ubuntu 安装python2](https://blog.csdn.net/My_CSDN_IT/article/details/114323834))
Binary file added windows/wsl/test.reg
Binary file not shown.
13 changes: 13 additions & 0 deletions windows/wsl/wsl打不开.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# wsl打不开

```
netsh winsock reset
```

* 管理员命令重启

* [参考1]([wsl突然打不开了,重启也没用。_LZ_夕阳之后的黑夜的博客-CSDN博客_wsl打不开了](https://blog.csdn.net/qq_41048761/article/details/121420814#:~:text=windows%E5%AD%90%E7%B3%BB%E7%BB%9F%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8%20wsl%20%E5%91%BD%E4%BB%A4%E6%97%A0%E6%95%88%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95%EF%BC%9A%20%E9%97%AE%E9%A2%98%EF%BC%9A%20wsl%20-l%20-v%E5%91%BD%E4%BB%A4%E6%97%A0%E5%8F%8D%E5%BA%94%20Windows,int%20ip%20reset%20netsh%20winsock%20reset%20%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE%EF%BC%9A%20https%3A%2F%2Fanswers.microsoft.com%2Fzh-ha))

* [参考2]([windows 下wsl 启动不了_zeloas的博客-CSDN博客_wsl启动不了](https://blog.csdn.net/yao_zhuang/article/details/117600570))

*
27 changes: 27 additions & 0 deletions windows/wsl/报错处理.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 常见报错

## WslRegisterDistribution failed with error: 0x80070005

* 报错是说wsl的distribution注册不了

* 需要在注册表里面编辑distribution相关配置项来解决问题。

* * [解决windows下WslRegisterDistribution failed with error: 0x80070050的问题 - freephp - 博客园 (cnblogs.com)](https://www.cnblogs.com/freephp/p/16152315.html))

* [win10下运行Ubuntu20.04.4 LTS 报错:WslRegisterDistribution failed with error: 0x80070050_qq_34830229的博客-CSDN博客](https://blog.csdn.net/qq_34830229/article/details/124917106?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-124917106-blog-124092111.pc_relevant_multi_platform_whitelistv4eslandingrelevant&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-124917106-blog-124092111.pc_relevant_multi_platform_whitelistv4eslandingrelevant&utm_relevant_index=1))

* ([Windows 10 子系统Linux重启(不重启Win10)_刘海琼宝宝的博客-CSDN博客](https://blog.csdn.net/u014155085/article/details/107085791))

## 检查命令

* 是检查映像以查看是否有检测到损坏

```
Dism /Online /Cleanup-Image /CheckHealth
```

* 是扫描你全部系统文件并和官方系统文件对比

```
Dism /Online /Cleanup-Image /ScanHealth
```

0 comments on commit 56d8ccf

Please sign in to comment.