"no such file or directory python" 为 Python 激活环境

"no such file or directory python" activate environment for Python

当我尝试激活环境时,在 Bash 中使用 cod $ source project1_env/bin/activate 他们 returns 以下消息 bash: project1_env/bin/activate: 否这样的文件或目录.

为什么我无法激活环境?环境 vile 位于正确的文件夹中,并且它们内部看起来都不错。我在 Windows 上使用 GIT Bash 到 Python 3.7。

我认为答案可以很简单,但我在这些论坛上没有看到类似的情况/问题。

非常感谢您的帮助!

this is a conda environment you are trying to activate? – FlyingTeller I think it isn't. Properly the first steps they were the same how in these tutorial. https://www.youtube.com/watch?v=N5vscPTWKOk (to 2:31 here i have i problem)

What does ls -l project1_env/bin return? – hoefling 16 mins ago tymot@DESKTOP-9GQ8RLI MINGW64 ~/Environments

$ ls -l project1_env/bin
ls: cannot access 'project1_env/bin': No such file or directory

尝试在路径前添加斜杠: 来源 /project1_env/bin/activate

  1. 首先改变你的方向到你的virtualenv目录
  2. 然后 运行 命令 .\Scripts\activate 激活虚拟 windows
  3. 中的环境
  4. bin/activate是用来激活虚拟环境的命令 在 linux 和 mac

以下适合我。
复制文件
Python35\Lib\venv\scripts\posix\activate

进入我的 project1_env\Scripts 文件夹
然后在 GIT bash 运行:
$来源project1_env/Scripts/activate

注意。将 'Python35' 更改为您自己的 Python 3.7 文件夹名称!

遇到类似问题,将 shell 更改为 bash 并修复。

键入 echo [=10=] 以获取当前环境。

然后输入/bin/bash进入bash环境,成功了。