windows-subsystem-for-linux - 在 /home 下无法运行 .exe 但在 /mnt/c 下可以
问题描述
.exe
在适用于 Linux 的 Windows 子系统中,当我在文件结构下时,我似乎能够运行文件,但在文件结构/mnt/c/...
下时却不行/home/...
。有没有办法.exe
在我的密码下访问文件/home/...
?
$ pwd
/mnt/c
$ "/c/Program Files/R/R-4.0.2/bin/Rscript.exe" -e "print('hello')"
[1] "hello"
$ cd ~
# pwd
/home/mpettis
$ "/c/Program Files/R/R-4.0.2/bin/Rscript.exe" -e "print('hello')"
(nothing run or returned)
如果这是安装文件系统的任何线索,这是我的df
输出:
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 498799612 133929648 364869964 27% /
none 498799612 133929648 364869964 27% /dev
none 498799612 133929648 364869964 27% /run
none 498799612 133929648 364869964 27% /run/lock
none 498799612 133929648 364869964 27% /run/shm
none 498799612 133929648 364869964 27% /run/user
cgroup 498799612 133929648 364869964 27% /sys/fs/cgroup
C: 498799612 133929648 364869964 27% /c
解决方案
在其中创建/etc/wsl.conf
并定义以下内容:
[automount]
enabled = true
options = "metadata,uid=1000,gid=1000,umask=0022,fmask=11,case=off"
mountFsTab = false
crossDistro = true
[network]
generateHosts = true
generateResolvConf = true
[filesystem]
umask = 0022
[interop]
enabled = true
appendWindowsPath = true
显式启用它为 true 的 interop 部分可能会解决此问题。请务必记住,如果您运行 WSL2 并且还使用 systemd hack,您的 Windows 互操作将中断,并且无法执行任何 exe 文件。
推荐阅读
- python - 将文本文件读入结构化 2D numpy 数组
- javascript - Bug Child component input to patch reactive form does not update on Oninit
- java - 带有“this”和没有“this”的代码之间的区别
- apollo-server - 如何将 GraphQLObjectType 与 graphql-tag 和 gql-tag 创建的模式结合起来?
- javascript - Vue 组件未使用插件语法加载
- algorithm - 改进/优化我糟糕代码的指南是 scala 中的图二分法
- javascript - iframe:设置 document.location 2x 后的白屏
- arrays - 复杂的 NumPy 数组操作
- php - Laravel 7 自定义 Artisan 命令使用现有类抛出 BindingResolutionException
- python - 加快搜索最小的 x 使得 f(x) = target