requirements.txt 错误的解释器:没有那个文件或目录

requirements.txt bad interpreter: No such file or directory

我正在开发我刚刚克隆的 github 存储库。我有一个新的虚拟环境,我想将 requirements.txt 文件中的所有包添加到虚拟环境中。

出于某种原因,它没有找到我的 requirements.txt 文件。

编辑 /Users/byrd/Desktop/Github Repositories/herokusite/venv/bin/pip 文件的第一行,将路径更正为 python。您可以通过调用 which python 来获取此路径。我觉得应该是:

#!/Users/byrd/Desktop/Github\ Repositories/herokusite/venv/bin/python

编辑:这似乎是 unix 中的一个已知错误 - 你 can't use spaces in shebang line

也试试这个workaround,它可能对你有帮助。

不要在存储虚拟环境的路径的任何部分使用空格。

它会导致引导过程出现问题。

在路径中没有空格的目录中创建一个新的空白环境:

$ cd  # this takes you to your home directory, in OSX its is /Users/yourlogin
$ cd Desktop
$ virtualenv myvenv
$ source myvenv/bin/activate
(myvenv) $ pip install -r /path/to/requirements.txt

首先,如果在任何文件夹之间发现 space,则在激活环境后执行 which pip as seen in this link

你一定注意到文件夹名称

之间有一个 space

2nd july

接下来,删除新的 virualenv(在我的例子中是 envname)并用 space 重命名文件夹

然后创建一个新的虚拟环境然后通过

安装需求
pip install -r requirements.txt

在包含需求文件的文件夹位置