pip install -r requirements.txt 错误,即使路径正确
pip install -r requirements.txt error, even though in correct path
我通过
创建了“requirements.txt”
pip freeze > requirements.txt
在本地目录并将其推送到我的远程 git 存储库。
然后我将它拉到位于“pythonanywhere.com”的 bash 控制台,然后移动到安装了“requirements.txt”的目录。
尝试过
pip install -r requirements.txt
但是出现错误:
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/tmp/build/.../.../work'
我正在使用 python 3.8 并且 pip 已经升级到最新版本。
我还检查了我是否走在正确的道路上
ls
它显示“requirements.txt”
有什么问题?
error screenshot
需求文件最常见的用例是仅列出安装包所需的包:
numpy
pandas
[...]
但是有一些高级选项,例如指定确切的版本。你可以有一个概览at the documentation。与您的情况相关的是以下段落:
Since version 19.1, pip also supports direct references like so:
SomeProject @ file:///somewhere/...
它告诉 pip 查找该特定文件。在你的需求文件中是这样的:
asgiref @ file:///tmp/build/80754af9/asgiref_1605055780383/work
如果指定的文件在其他服务器上不存在,自然失败。
我不确定你是怎么到那里的(一些不常见的安装包的方法?conda 会安装这样的包吗?),但一个简单的修复方法是编辑 requirements.txt
以仅列出您要安装的软件包,可选版本,例如:
asgiref
certifi==2020.12.5
Django
mkl-fft==1.2.0
mkl-random==1.1.1
mkl-service==2.3.0
numpy
olefile==0.46
Pillow
psycopg2
pytz
six
sqlparse
wincertstore==0.2
当然,这可能会安装与最初版本略有不同的版本。如果您最初是通过不同的包管理器(例如 conda)安装包的,可能会有更好的命令来存档 python 环境。
我通过
创建了“requirements.txt”pip freeze > requirements.txt
在本地目录并将其推送到我的远程 git 存储库。
然后我将它拉到位于“pythonanywhere.com”的 bash 控制台,然后移动到安装了“requirements.txt”的目录。
尝试过
pip install -r requirements.txt
但是出现错误:
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/tmp/build/.../.../work'
我正在使用 python 3.8 并且 pip 已经升级到最新版本。 我还检查了我是否走在正确的道路上
ls
它显示“requirements.txt”
有什么问题?
error screenshot
需求文件最常见的用例是仅列出安装包所需的包:
numpy
pandas
[...]
但是有一些高级选项,例如指定确切的版本。你可以有一个概览at the documentation。与您的情况相关的是以下段落:
Since version 19.1, pip also supports direct references like so:
SomeProject @ file:///somewhere/...
它告诉 pip 查找该特定文件。在你的需求文件中是这样的:
asgiref @ file:///tmp/build/80754af9/asgiref_1605055780383/work
如果指定的文件在其他服务器上不存在,自然失败。
我不确定你是怎么到那里的(一些不常见的安装包的方法?conda 会安装这样的包吗?),但一个简单的修复方法是编辑 requirements.txt
以仅列出您要安装的软件包,可选版本,例如:
asgiref
certifi==2020.12.5
Django
mkl-fft==1.2.0
mkl-random==1.1.1
mkl-service==2.3.0
numpy
olefile==0.46
Pillow
psycopg2
pytz
six
sqlparse
wincertstore==0.2
当然,这可能会安装与最初版本略有不同的版本。如果您最初是通过不同的包管理器(例如 conda)安装包的,可能会有更好的命令来存档 python 环境。