學習project第二期
GitHub地址:https://github.com/ZhengJun-AI/TechDepart-LearningTask
任務
更換 apt-get 的軟件源爲阿里雲,並安裝 vim 和 git
上網查找了切換源的方法
1.備份系統自帶源
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2.修改源來源
vim /etc/apt/sources.list
將原有內容修改爲如下:
deb-src http:``//archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties deb http:``//mirrors.aliyun.com/ubuntu/ xenial main restricted deb-src http:``//mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties deb http:``//mirrors.aliyun.com/ubuntu/ xenial-updates main restricted deb-src http:``//mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties deb http:``//mirrors.aliyun.com/ubuntu/ xenial universe deb http:``//mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http:``//mirrors.aliyun.com/ubuntu/ xenial multiverse deb http:``//mirrors.aliyun.com/ubuntu/ xenial-updates multiverse deb http:``//mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb-src http:``//mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties deb http:``//archive.canonical.com/ubuntu xenial partner deb-src http:``//archive.canonical.com/ubuntu xenial partner deb http:``//mirrors.aliyun.com/ubuntu/ xenial-security main restricted deb-src http:``//mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties deb http:``//mirrors.aliyun.com/ubuntu/ xenial-security universe deb http:``//mirrors.aliyun.com/ubuntu/ xenial-security multiverse
熟悉 vim 的用法
之前有過一些瞭解,主要是快捷鍵比較多,但是如果有用 VScode 的經驗,感覺還不錯。只是要把快捷鍵全背下來需要一些時間。
上面在修改源的時候運用了幾個指令。
命令模式下 dG 刪除從光標到文件尾所有內容,將內容粘貼進去後,使用 :wq 保存退出。
熟悉 git 的用法,創建 repo 並設置合作者
主要是使用命令行將此次報告上傳比較麻煩。主要步驟如下:
(參考資料:https://www.liaoxuefeng.com/wiki/896043488029600/896954117292416)
1.創建 SSH key:
$ ssh-keygen -t rsa -C "[email protected]"
2.在用戶主目錄下查看 .ssh目錄,id_rsa和 id_rsa.pub兩個文件,這兩個就是SSH Key的祕鑰對,id_rsa是私鑰,不能泄露出去,id_rsa.pub是公鑰,可以放心地告訴任何人。
3.打開 GitHub的 Account Settings的 SSH Keys界面,將 id_rsa.pub添加進去。
(爲什麼 GitHub需要 SSH Key呢?因爲 GitHub需要識別出你推送的提交確實是你推送的,而不是別人冒充的,而 Git支持 SSH協議,所以,GitHub只要知道了你的公鑰,就可以確認只有你自己才能推送。當然,GitHub允許你添加多個 Key。)
4.將本地版本庫與遠程庫關聯:
$ git remote add origin [email protected]:ZhengJun-AI/TechDepart-LearningTask.git
5.直接 push沒有成功,好像是因爲本地沒有 README.md。所以先進行一次 pull操作,然後這個也出現了問題,似乎是因爲 histiory不一致,不是很理解但是也找到了解決辦法。
(參考資料:https://blog.csdn.net/Stephen_mu/article/details/83058430)
(參考資料:https://blog.csdn.net/chaiyu2002/article/details/82120256)
$ git pull --allow-unrelated-histories origin master From github.com:ZhengJun-AI/TechDepart-LearningTask * branch master -> FETCH_HEAD Merge made by the 'recursive' strategy. LICENSE | 21 +++++++++++++++++++++ README.md | 7 +++++++ 2 files changed, 28 insertions(+) create mode 100644 LICENSE create mode 100644 README.md
6.接下來就是 push操作。
$ git push origin master Enumerating objects: 6, done. Counting objects: 100% (6/6), done. Delta compression using up to 8 threads Compressing objects: 100% (5/5), done. Writing objects: 100% (5/5), 1.42 KiB | 1.42 MiB/s, done. Total 5 (delta 0), reused 0 (delta 0) To github.com:ZhengJun-AI/TechDepart-LearningTask.git 8de9079..3d122ad master -> master
安裝python
在解壓完壓縮包,試圖配置prefix路徑的時候出錯了。後查找各方資料,嘗試種種解決方案,均無果。
(參考資料:https://blog.csdn.net/sxhong/article/details/740572)
./configure --prefix=/opt/python checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for python3.7... no checking for python3... python3 checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... checking for --without-gcc... no checking for --with-icc... no checking for gcc... gcc checking whether the C compiler works... no configure: error: in /home/zxbsmk/Downloads/Python-3.7.3': configure: error: C compiler cannot create executables See 'config.log' for more details
方法一:檢查 gcc版本,更新或重新安裝
方法二:環境變量等設置問題