我想在我的 setup.bash 脚本中添加这样的东西。
ln -s /mnt/c/Users/Ryan/Downloads $HOME/Downloads
Run Code Online (Sandbox Code Playgroud)
但显然事实并非总是准确的路径,所以我希望能够做的事情一样
ln -s /mnt/c/Users/%USERNAME%/Downloads $HOME/Downloads
Run Code Online (Sandbox Code Playgroud)
或者
ln -s %USERPROFILE%/Downloads $HOME/Downloads
Run Code Online (Sandbox Code Playgroud)
我知道,很明显的Windows%瓦尔在bash是行不通的,但如果能WSL这将是冷静/不出口这些瓦尔作为$Win32.HOME或$Win32.USER什么的。
有什么想法吗?
有没有办法做到这一点?
我尝试使用 NVM 在 WSL 上安装 Node LTS。当我成功安装 nvm 时,使用 Node 安装出现nvm install --lts了一些错误:
mv: cannot move '/home/anesin1109/.nvm/.cache/bin/node-v10.15.3-linux-x64/files/bin' to '/home/anesin1109/.nvm/versions/node/v10.15.3/bin': Permission denied
mv: cannot move '/home/anesin1109/.nvm/.cache/bin/node-v10.15.3-linux-x64/files/include' to '/home/anesin1109/.nvm/versions/node/v10.15.3/include': Permission denied
mv: cannot move '/home/anesin1109/.nvm/.cache/bin/node-v10.15.3-linux-x64/files/lib' to '/home/anesin1109/.nvm/versions/node/v10.15.3/lib': Permission denied
mv: cannot move '/home/anesin1109/.nvm/.cache/bin/node-v10.15.3-linux-x64/files/share' to '/home/anesin1109/.nvm/versions/node/v10.15.3/share': Permission denied
Run Code Online (Sandbox Code Playgroud)
我试图手动移动这些文件,但它也以这些错误结束。
有没有办法将 Windows Maven 和 WSL Maven 配置为使用相同的.m2/repository和settings.xml?
在我.bashrc的 WSL 中,我添加了M2_HOME使用与 Windows 10 相同的安装:
.bashrc:
export M2_HOME=/mnt/c/development/maven
视窗路径:
C:\development\maven
但是当我mvn clean install在 Windows Bash 上执行时,会在 ~/.m2(WSL 文件夹系统)中创建一个 .m2 文件夹。
我无法在 Docker 和 WSL 2 中运行的 Kubernetes 中使用 HostPath 正确挂载卷。在 Docker 中运行的 Kubernetes 中挂载卷时,这似乎是 WSL 2 问题。有人知道怎么修这个东西吗?
以下是步骤:
为我的应用程序将调试版本部署到 Kubernetes。使用 Kubernetes 扩展附加 Visual Studio Code 导航到我的应用程序的项目文件夹,该应用程序使用卷挂载 <= 问题就在这里
当您查看卷挂载时,什么也没有。
C:\Windows\System32>wsl -l -v
NAME STATE VERSION
Ubuntu Running 2
docker-desktop-data Running 2
docker-desktop Running 2
Docker Desktop v2.3.0.3
Kubernetes v1.16.5
Visual Studio Code v1.46.1
Run Code Online (Sandbox Code Playgroud)
====================================================================
Dockerfile
====================================================================
#
# Base image for deploying and running based on Ubuntu
#
# Support ASP.NET and does not include .NET SDK or NodeJs
# …Run Code Online (Sandbox Code Playgroud) 我Ubuntu在 wsl2 上运行 5 个不同的发行版,但它们都具有相同的 ip 地址。例如Ubuntu 18.04,并且Ubuntu 20.04具有相同的 ip。每个版本可以有不同的ip吗Ubuntu?
我正在使用 WSL 如何通过控制台将 Python 升级到最新版本?
现在我有3.8.10
/home/user/.local/lib/python3.8/site-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.1.36ubuntu1 是无效版本,未来版本将不再支持
造成这种情况的原因是什么?可以采取什么措施来解决它?
我已经为 Windows 11 发行版和 Ubuntu 20.04 安装了 WSL。我看到很多人说我可以使用命令而无需使用wsl命令打开发行版。
不知怎的,这对我不起作用。当我输入命令时,wsl结果是:
Processing fstab with mount -a failed.
Run Code Online (Sandbox Code Playgroud)
例如:wsl rsync -r -v /mnt/d/DUMMY_SOURCE/ /mnt/e/DUMMY_DESTINATION
唯一真正有效的 wsl 命令是wsl -l -v
NAME STATE VERSION
* docker-desktop-data Stopped 2
docker-desktop Stopped 2
Ubuntu-20.04 Stopped 2
Run Code Online (Sandbox Code Playgroud)
我的设置有什么问题吗?
我尝试在我的 WSL2 本地主机客户端和服务器之间发送 udp 数据包,我可以成功发送数据,但是当想要在wireshark上进行分析时,wireshark无法在环回流量适配器和vEthernet捕获处捕获任何内容。在发送者代码之后运行程序和wireshark窗口图像。
发送者.cpp
#define PORT 50254
int main(){
Client* client = new Client("127.0.0.1", PORT);
memset(&client->serv_addr, 0, sizeof(client->serv_addr));
client->serv_addr.sin_family = AF_INET;
client->serv_addr.sin_port = htons(port);
client->serv_addr.sin_addr.s_addr = inet_addr(client->ipAddres);
if ((client->Socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("socket creation failed");
exit(EXIT_FAILURE);
}
if (connect(client->Socket, (struct sockaddr*)&client->serv_addr, sizeof(client->serv_addr)) < 0)
{
printf("\n Error : Connect Failed \n");
exit(0);
}
char* message = "Hello Server";
cout << "Sent Size : " << send(client->Socket,message, 100, 0) << endl;
}
Run Code Online (Sandbox Code Playgroud)
目标:在终端中常规使用 Bash 和 Git 来处理 Visual Studio Code 中的 Python 项目。
\n每当我启动时,我都会看到此错误。我无法打开代码或使用终端。
\n\n错误信息:
\nThe editor cannot be opened due to an unexpected error: No file system provider found for resource \'vscode-remote://wsl%2Bubuntu/...\'\nRun Code Online (Sandbox Code Playgroud)\n更新:卸载 WSL。我不再有下面的旧终端输出。
\n终端:
\n[2022-06-13 15:53:18.277] Resolving wsl+ubuntu, resolveAttempt: 1\n[2022-06-13 15:53:18.361] Starting VS Code Server inside WSL (wsl1)\n[2022-06-13 15:53:18.361] Extension version: 0.66.3\n[2022-06-13 15:53:18.361] Windows build: 19044. Multi distro support: available. WSL path support: enabled\n[2022-06-13 15:53:18.361] No shell environment set or found …Run Code Online (Sandbox Code Playgroud) windows-10 visual-studio-code windows-subsystem-for-linux wsl-2
windows-subsystem-for-linux ×10
windows-10 ×2
wsl-2 ×2
c++ ×1
console ×1
docker ×1
kubernetes ×1
maven ×1
nvm ×1
pipenv ×1
powershell ×1
python ×1
ubuntu ×1
upgrade ×1
virtualenv ×1
windows ×1
wireshark ×1