如何通过gitbash和Python运行工作目录中的文件

如何通过gitbash和Python运行工作目录中的文件,python,bash,anaconda,git-bash,Python,Bash,Anaconda,Git Bash,我在通过Git Bash运行Python 3时遇到了一些问题,这是我与Anaconda一起安装的。我可以通过输入python访问交互式环境,但只要我输入: python webscraper.py 我明白了: C:/Users/[My username]/anaconda3/python.exe: can't open file 'webscraper.py': [Errno 2] No such file or directory 当我遇到这些错误时,Python文件与我当前使用的目录相同

我在通过Git Bash运行Python 3时遇到了一些问题,这是我与Anaconda一起安装的。我可以通过输入
python
访问交互式环境,但只要我输入:

python webscraper.py
我明白了:

C:/Users/[My username]/anaconda3/python.exe: can't open file 'webscraper.py': [Errno 2]
No such file or directory

当我遇到这些错误时,Python文件与我当前使用的目录相同。通过Anaconda到我的Python版本的路径看起来也是正确的。我以前能够在Bash中测试脚本,但不得不重新安装它以解决其他一些问题。

首先,检查您是否使用了正确的python:

which python # in your git bash session
然后使用文件的完整绝对路径名进行测试:


首先,检查您使用的python是否正确:

which python # in your git bash session
然后使用文件的完整绝对路径名进行测试:


你激活环境了吗?你能分享目录的内容吗?你激活环境了吗?你能分享目录的内容吗?