win10+wsl+vscode+rust+wasmedge+pytorch+git开发环境搭建

1、安装wsl:略

 

如果原来的wsl子系统有问题,可以重置:

重置后,可能因为多个wsl系统导致不是默认,通过下面命令查看和更改默认wsl系统:

#查看wsl系统列表
wslconfig /list
#更改默认wsl系统
wslconfig /setdefault Ubuntu-20.04

后面的都是用root权限安装否则会出现很多权限不够用的情况

2、wsl安装rust:

(1)调整rustup安装源为国内镜像地址,我采用抖音的镜像如下:

export RUSTUP_DIST_SERVER="https://rsproxy.cn"
export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"

然后开始安装rustup:

 curl --proto '=https' --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh

安装结束按提示更新文件让其生效:

source "$HOME/.cargo/env"

添加rust  wasi编译组件

rustup target add wasm32-wasi

 升级apt工具更新最新git

add-apt-repository ppa:git-core/ppa
apt-get update
apt-get install git

手动安装wasmedge编译组件

#官网地址https://wasmedge.org/book/en/contribute/build_from_src/linux.html
#For Ubuntu 22.04
# Tools and libraries
sudo apt install -y \
   software-properties-common \
   cmake \
   libboost-all-dev

# And you will need to install llvm for the AOT runtime
sudo apt install -y \
   llvm-14-dev \
   liblld-14-dev

# WasmEdge supports both clang++ and g++ compilers.
# You can choose one of them to build this project.
# If you prefer GCC, then:
sudo apt install -y gcc g++
# Or if you prefer clang, then:
sudo apt install -y clang-14


#For Ubuntu 20.04
# Tools and libraries
sudo apt install -y \
   software-properties-common \
   cmake \
   libboost-all-dev

# And you will need to install llvm for the AOT runtime
sudo apt install -y \
   llvm-12-dev \
   liblld-12-dev

# WasmEdge supports both clang++ and g++ compilers.
# You can choose one of them to build this project.
# If you prefer GCC, then:
sudo apt install -y gcc g++
# Or if you prefer clang, then:
sudo apt install -y clang-12

3、修改cargo为国内镜像地址,我使用清华的镜像,首先找到cargo位置,如果没记住可使用:

whereis  cargo

在cargo安装目录bin上级目录中创建config文件:

touch config

使用vim打开config文件:

vim config

输入清华镜像地址:

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"

# 替换成你偏好的镜像源
replace-with = 'sjtu'
#replace-with = 'ustc'

# 清华大学
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"

# 中国科学技术大学
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"

# 上海交通大学
[source.sjtu]
registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"

# rustcc社区
[source.rustcc]
registry = "git://crates.rustcc.cn/crates.io-index"

#这一个一定要,否则会出现cargo update报错问题
[net]
git-fetch-with-cli=true

4、使用git下载WasmEdge-WASINN-examples:

https://github.com/second-state/WasmEdge-WASINN-examples.git

6、安装wasmedge:

#没有wasi-nn的版本
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash
#存在wasi-nn的版本
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -v 0.11.2 --plugins wasi_nn-pytorch

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值