【问题标题】:What is the Correct Network Folder Address in Python on Linux or WSL?Linux 或 WSL 上的 Python 中正确的网络文件夹地址是什么?
【发布时间】:2021-01-06 09:53:46
【问题描述】:

所以,我一直在 Windows 上使用 VS Code 来开发 Python。 我在网络文件夹中引用了一个文件 excel:

file = r'\\192.168.1.100\Data\Project\Client\CTR01\Schedule.xlsx'

但是当我在 WSL (Ubuntu) 上使用 VS Code 时,代码无法访问上面的地址。

FileNotFoundError: [Errno 2] No such file or directory: '\\\\192.168.1.100\\Data\\Project\\Client\\CTR01\\Schedule.xlsx'

Linux 中网络文件夹中引用文件的正确代码是什么? 我需要导入特定的模块或包吗?

仅供参考,不需要用户名和密码。 之前谢谢。

【问题讨论】:

    标签: python linux windows networking windows-subsystem-for-linux


    【解决方案1】:

    一种解决方法是预先安装网络驱动器:

    sudo mkdir /mnt/192.168.1.100-Data
    sudo mount -t drvfs '\\192.168.1.100\Data' /mnt/192.168.1.100-Data
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-25
      • 1970-01-01
      • 1970-01-01
      • 2017-12-05
      • 2012-07-03
      • 2023-03-06
      相关资源
      最近更新 更多