Win10 下使用Ubuntu子系统

1. 安装win10子系统

1. 开启开发者模式
系统设置 -> 更新和安全 -> 针对开发人员 -> 选择开发者模式
2. 启用 Linux 子系统组件
系统设置 -> 应用 -> 右侧的程序和功能 -> 启动或关闭windows功能 -> 勾选适用于 Linux 的 Windows 子系统
设置完成后重启更新即可 
3. 安装 Linux 子系统
打开 Windows 应用市场,输入 linux 搜索,选择你自己想要的系统版本,我选择的是 Ubuntu ,然后下载安装。 

 2. 安装 miniconda

https://docs.conda.io/en/latest/miniconda.html
mkdir download
cd download
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-latest-Linux-x86_64.sh
重新打开一个shell cmd窗口
conda create -n carla python=3.7

3. 安装MotionPro vpn

http://client.arraynetworks.com.cn:8080/zh/troubleshooting

wget http://array-support.oss-cn-shanghai.aliyuncs.com/ag/motionpro/linux/ubuntu/1.2.6/MotionPro_Linux_Ubuntu_x64_v1.2.6.sh?OSSAccessKeyId=LTAIf6u4r98UB4oP&Expires=1583193933&Signature=nj7p4BJALpr0ZznTWdmffEu65Lg%3D

sh /mnt/e/download/MotionPro_Linux_Ubuntu_x64_v1.2.6.sh

 

 4. Ubuntu16.04如何安装最新版安装gcc

16.04需要升级
sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-7 sudo apt-get install g++-7
配置:将gcc7,g++7作为默认选项
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100
sudo update-alternatives --config gcc

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 100
sudo update-alternatives --config g++
查看是否成功:

gcc --version
g++ --version


18.04默认安装的就是7.4版本

sudo apt update

sudo apt install build-essential  


 apt安装cmake,Ubuntu18.04的版本是3.10.2,Ubuntu1604版本是3.5
sudo apt install cmake

前往官网下载CMake的压缩包
https://cmake.org/download/
下载后解压,然后进入目录执行:
./bootstrap
make -j8
sudo make install
查看版本号:
cmake --version

安装完成后会触发以下错误
CMake Error:Could not find CMAKE_ROOT!!!
CMake has most likely not been installed correctly.
Modules directory not found in /usr/local/bin
Segmentation fault (core dumped)

【解决方法】

先执行:hash -r

然后再执行:cmake --version

完美解决



 

Ubuntu apt-cache show命令查看lib库的版本信息

apt-cache show cmake

 


 

 

7. libwebp编译

http://www.linuxfromscratch.org/blfs/view/svn/general/libwebp.html

tar -xzvf libwebp-1.1.0.tar.gz

Install libwebp by running the following commands:

Install libwebp by running the following commands:

./configure --prefix=/usr           \
            --enable-libwebpmux     \
            --enable-libwebpdemux   \
            --enable-libwebpdecoder \
            --enable-libwebpextras  \
            --enable-swap-16bit-csp \
            --disable-static        &&
make
This package does not come with a test suite.

Now, as the root user:

sudo make install

  

8. conda使用

1 (base) $ conda --version
2 conda 4.7.12
3 (base) $ conda info --envs
4 # conda environments:
5 #
6 base                  *  /home/qq/miniconda3
7 carla                    /home/qq/miniconda3/envs/carla

9. 显示文件夹前多少个文件

ls | head -n 100

 

显示文件夹前多少个文件
ls | head -n 100
显示文件的前后多少行
可以使用head(查看前几行)、tail(查看末尾几行)两个命令。
例如:
查看/etc/profile的前10行内容,应该是:
# head -n 10 /etc/profile
查看/etc/profile的最后5行内容,应该是:
# tail  -n 5 /etc/profile
如果想同时查看可以将前10行和后5行的显示信息通过输出重定向的方法保存到一个文档,这样查看文档即可一目了然。
例如:
将内容输出到/home/test文件中
# head -n 10 /etc/profile >>/home/test
# tail  -n 5 /etc/profile>>/home/test
查看的话只需要打开test文件即可。
cat /home/test
【一】从第3000行开始,显示1000行。即显示3000~3999行
cat filename | tail -n +3000 | head -n 1000
 
【二】显示1000行到3000行
cat filename| head -n 3000 | tail -n +1000 
 
*注意两种方法的顺序
 
分解:
    tail -n 1000:显示最后1000行
    tail -n +1000:从1000行开始显示,显示1000行以后的
    head -n 1000:显示前面1000行
 
【三】用sed命令
 
 sed -n '5,10p' filename 这样你就可以只查看文件的第5行到第10行。

  

 

 

 

 

10. git 添加 ssh

问题描述
git通过ssh认证推拉代码过程:
ssh-keygen -t rsa -C "xxxx.com" -f ~/.ssh/one_xxx_rsa
在git上添加ssh的add key
git clone git@xxx.git
问题出现在第三步,拉取代码失败,需要手动输入密码
解决方法
eval `ssh-agent -s` #启动ssh-agent
ssh-add "私钥文件的绝对路径地址" # 添加私钥到agent 如:ssh-add "c:/Users/xxx/.ssh/id_rsa"

 

11. 查找当前python的依赖库

使用pip freeze
$ pip freeze > requirements.txt
这种方式配合virtualenv 才好使,否则把整个环境中的包都列出来了。

使用 pipreqs ./
这个工具的好处是可以通过对项目目录的扫描,自动发现使用了那些类库,自动生成依赖清单。
缺点是可能会有些偏差,需要检查并自己调整下。

 

 

posted on 2020-03-05 17:10  jobgeo  阅读(712)  评论(0编辑  收藏  举报

导航