简体   繁体   English

在Windows Linux上的Ubuntu上进行bash,文件夹识别以及运行Python脚本

[英]bash on Ubuntu on windows Linux, folder recognition, and running Python scripts

I'm new to Linux. 我是Linux的新手。 I recently downloaded Bash on Ubuntu on Windows 10 (after the Anniversary edition update to Windows 10). 我最近在Windows 10上的Ubuntu上下载了Bash(在周年纪念版更新到Windows 10之后)。 Since this update is relatively new, there is not much online regarding troubleshooting. 由于此更新是相对较新的,因此有关故障排除的在线信息并不多。 There are two things I need help on: 我需要帮助的两件事:

(1) When I go to the home folder, which seems to be "C:\\Users\\user\\AppData\\Local\\lxss\\home\\user\u0026quot; and I add a new folder through Windows, this folder does not show up in Linux with the "ls" command. (1)当我转到主文件夹(似乎是“ C:\\ Users \\ user \\ AppData \\ Local \\ lxss \\ home \\ user”)并通过Windows添加新文件夹时,该文件夹在Linux中不显示使用“ ls”命令。 But when I add a directory using "mkdir" in Linux, the "ls" command shows this folder. 但是,当我在Linux中使用“ mkdir”添加目录时,“ ls”命令将显示此文件夹。 Why is it behaving like this? 为什么会这样? Am I limited to creating folders through "mkdir" when working in this folder? 在此文件夹中工作时,我是否只能通过“ mkdir”创建文件夹?

(2) I have a Python script sitting in that same folder that I'm trying to run and again it is not being found by Linux or the Python interpreter started in Bash on Ubuntu on Windows. (2)我有一个Python脚本位于我尝试运行的同一文件夹中,但Linux或Windows上在Ubuntu上的Bash中启动的Python解释器都找不到该脚本。 I have Python 3 installed (Anaconda) and I'm able to type commands directly in the Python interpreter and it's working. 我已经安装了Python 3(Anaconda),并且能够直接在Python解释器中键入命令,并且它可以正常工作。 However, I would like to run scripts in files. 但是,我想在文件中运行脚本。

Please let me know if more information is needed. 请让我知道是否需要更多信息。 Thanks. 谢谢。

The reason why ls is not showing anything is that it shows the Linux directory structure. ls没有显示任何内容的原因是它显示了Linux目录结构。 Try setting it to the Windows directory, in this example the c drive: 尝试将其设置为Windows目录,在此示例中为c驱动器:

cd /mnt/c

Does ls show a folder structure now? ls现在显示文件夹结构吗?

Looks like you are having permissions issues. 看来您遇到权限问题。 To see everything on your home folder try ls -al to change permissions check out the chmod command 要查看主文件夹上的所有内容,请尝试使用ls -al更改权限,请检查chmod命令

How about using Python for Windows and NotePad++ to edit and run your Python scripts? 在Windows和NotePad ++中使用Python编辑和运行Python脚本怎么样? https://www.python.org/ftp/python/3.5.2/python-3.5.2-amd64.exe https://www.python.org/ftp/python/3.5.2/python-3.5.2-amd64.exe

You can setup NotePad++ as described here. 您可以按照此处的说明设置NotePad ++。 How to Execute a Python File in Notepad ++? 如何在记事本++中执行Python文件?

(I ended up using Cloud9 https://c9.io/ for Python. It is independent of your local environment or OS) (我最终将Cloud9 https://c9.io/用于Python。它独立于您的本地环境或OS)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM