代码之家  ›  专栏  ›  技术社区  ›  Shams Nahid

如何使用蟒蛇?[复制品]

  •  2
  • Shams Nahid  · 技术社区  · 7 年前

    我安装 anaconda 用于我的Windows10 PC中的python 3.7。

    当我放 python 在里面 gitBash 它说

    bash: python: command not found

    如何全局使用python?所以我可以在任何地方使用python命令。

    4 回复  |  直到 7 年前
        1
  •  1
  •   xudesheng    7 年前

    您应该执行“anaconda prompt”,然后从那里启动“python”。

    在Windows10上安装水蟒时,不建议“添加到路径”。所以,来自蟒蛇的普通蟒蛇不在你的路径上。

        2
  •  0
  •   Glyphack    7 年前

    将python添加到路径中,如下所示:

    $ PATH=$PATH:/path/to/python
    

    不要指定.exe,然后可以从git bash使用它

        3
  •  0
  •   hygull    7 年前

    @不,你可以在 Conda not recognized as internal or external after creating new environment .

    • 关闭已打开的终端。

    • 按照链接中给出的说明操作。

    • 打开新终端(Git bash)。

    • 类型 winpty python python -i (简单打字) python 在终端上不工作)。

    如果您遇到任何问题,请在此享受并询问/评论。

        4
  •  0
  •   Prayson W. Daniel    7 年前

    这取决于你把水蟒装在哪里。除非安装了Linux版本的anaconda(最好是miniconda),否则需要将gitbash指向Windowspython。例如在GITBASH中

    alias python='winpty python.exe'
    

    如果您想让一个特定的python“winpty fullpath/python.exe”成为永久性的,请将该命令添加到.bashrc中。

    cd ~
    touch .bashrc
    

    然后添加上面的命令。保存并重新启动终端。

    类似问题: Python not working in the command line of git bash