为什么 pip 要求文件包含“@​​file”而不是版本号?

Why does the pip requirements file contain "@file" instead of version number?

我用 pip freeze > requirements.txt 创建了 requirements.txt。一些模块显示@file..... 而不是版本号。这是什么意思,为什么显示?

康达:4.8.3

这是 requirements.txt 的结果。例如astroid、flask-admin、matplotlib 在下方显示“@文件”

astroid @ file:///opt/concourse/worker/volumes/live/b22b518b-f584-4586-5ee9-55bfa4fca96e/volume/astroid_1592495912194/work
bcrypt==3.1.7
blinker==1.4
certifi==2020.6.20
cffi==1.14.0
click==7.1.2
cycler==0.10.0
dnspython==1.16.0
ecdsa==0.13
email-validator @ file:///home/conda/feedstock_root/build_artifacts/email_validator_1589962946737/work
flake8==3.8.3
Flask==1.1.2
Flask-Admin @ file:///tmp/build/80754af9/flask-admin_1592429635880/work
Flask-Bcrypt==0.7.1
Flask-Login==0.5.0
Flask-Mail==0.9.1
flask-msearch==0.2.9
Flask-SQLAlchemy==2.4.3
Flask-WTF==0.14.3
gunicorn==20.0.4
idna==2.9
importlib-metadata==1.6.1
isort==4.3.21
itsdangerous==1.1.0
Jinja2==2.11.2
kiwisolver==1.2.0
lazy-object-proxy==1.4.3
MarkupSafe==1.1.1
matplotlib @ file:///Users/runner/miniforge3/conda-bld/matplotlib-base_1592576116805/work
mccabe==0.6.1
mkl-fft==1.1.0
mkl-random==1.1.1
mkl-service==2.3.0
numpy==1.18.5
pandas @ file:///opt/concourse/worker/volumes/live/38d1301c-8fa9-4d2f-662e-34dddf33b183/volume/pandas_1592841668171/work
psycopg2==2.8.4
pycodestyle @ file:///home/conda/feedstock_root/build_artifacts/pycodestyle_1589305246696/work
pycparser==2.20
pycryptodome==3.9.7
pyflakes==2.2.0
pylint @ file:///opt/concourse/worker/volumes/live/42ede439-2571-4cb2-513c-394625d2381b/volume/pylint_1592496039330/work
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2020.1
six @ file:///home/conda/feedstock_root/build_artifacts/six_1590081179328/work
SQLAlchemy==1.3.17
toml @ file:///tmp/build/80754af9/toml_1592853716807/work
tornado==6.0.4
typed-ast==1.4.1
Werkzeug==1.0.1
wrapt==1.11.2
WTForms==2.3.1
xlrd==1.2.0
zipp==3.1.0

这是 conda 列表

astroid                   2.4.2                    py37_0    anaconda
bcrypt                    3.1.7            py37h9bfed18_1    conda-forge
blas                      1.0                         mkl    anaconda
blinker                   1.4                        py_1    conda-forge
ca-certificates           2020.1.1                      0    anaconda
certifi                   2020.6.20                py37_0    anaconda
cffi                      1.14.0           py37h356ff06_0    conda-forge
click                     7.1.2                      py_0    anaconda
cycler                    0.10.0                     py_2    conda-forge
dnspython                 1.16.0                     py_1    conda-forge
ecdsa                     0.13                       py_0    conda-forge
email_validator           1.1.1              pyh9f0ad1d_0    conda-forge
flake8                    3.8.3                      py_0    anaconda
flask                     1.1.2                      py_0    anaconda
flask-admin               1.5.4                      py_0    anaconda
flask-bcrypt              0.7.1                      py_1    conda-forge
flask-login               0.5.0                      py_0    anaconda
flask-mail                0.9.1                      py_2    conda-forge
flask-msearch             0.2.9                    pypi_0    pypi
flask-sqlalchemy          2.4.3                    pypi_0    pypi
flask-wtf                 0.14.3                     py_0    anaconda
freetype                  2.10.2               h8da9a1a_0    conda-forge
gmp                       6.2.0                h4a8c4bd_2    conda-forge
gunicorn                  20.0.4                   py37_0    anaconda
idna                      2.9                        py_1    conda-forge
importlib-metadata        1.6.1                    py37_0    anaconda
intel-openmp              2020.1                      216    anaconda
isort                     4.3.21                   py37_0    anaconda
itsdangerous              1.1.0                    py37_0    anaconda
jinja2                    2.11.2                     py_0    anaconda
kiwisolver                1.2.0            py37ha1cc60f_0    conda-forge
krb5                      1.16.4               hddcf347_0    anaconda
lazy-object-proxy         1.4.3            py37h1de35cc_0    anaconda
libcxx                    10.0.0                        1  
libedit                   3.1.20191231         haf1e3a3_0  
libffi                    3.2.1                h0a44026_6  
libgfortran               3.0.1                h93005f0_2    anaconda
libpng                    1.6.37               hbbe82c9_1    conda-forge
libpq                     11.2                 h051b688_0    anaconda
markupsafe                1.1.1            py37h1de35cc_0    anaconda
matplotlib                3.2.2                         0    conda-forge
matplotlib-base           3.2.2            py37hddda452_0    conda-forge
mccabe                    0.6.1                    py37_1    anaconda
mkl                       2019.4                      233    anaconda
mkl-service               2.3.0            py37hfbe908c_0    anaconda
mkl_fft                   1.1.0            py37hc64f4ea_0    anaconda
mkl_random                1.1.1            py37h959d312_0    anaconda
ncurses                   6.2                  h0a44026_1  
numpy                     1.18.5           py37h1da2735_0    anaconda
numpy-base                1.18.5           py37h3304bdc_0    anaconda
openssl                   1.1.1g               h1de35cc_0    anaconda
pandas                    1.0.5            py37h959d312_0    anaconda
pip                       20.1.1                   py37_1  
psycopg2                  2.8.4            py37ha12b0ac_0    anaconda
pycodestyle               2.6.0              pyh9f0ad1d_0    conda-forge
pycparser                 2.20                       py_0    conda-forge
pycryptodome              3.9.7            py37h51495b9_1    conda-forge
pyflakes                  2.2.0                      py_0    anaconda
pylint                    2.5.3                    py37_0    anaconda
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
python                    3.7.6                h359304d_2  
python-dateutil           2.8.1                      py_0    anaconda
python_abi                3.7                     1_cp37m    conda-forge
pytz                      2020.1                     py_0    anaconda
readline                  7.0                  h1de35cc_5  
setuptools                47.3.1                   py37_0  
six                       1.15.0             pyh9f0ad1d_0    conda-forge
sqlalchemy                1.3.17                   pypi_0    pypi
sqlite                    3.32.3               hffcf06c_0  
tk                        8.6.10               hb0a8c7a_0  
toml                      0.10.1                     py_0    anaconda
tornado                   6.0.4            py37h9bfed18_1    conda-forge
typed-ast                 1.4.1            py37h1de35cc_0    anaconda
werkzeug                  1.0.1                      py_0    anaconda
wheel                     0.34.2                   py37_0  
wrapt                     1.11.2           py37h1de35cc_0    anaconda
wtforms                   2.3.1                      py_0    anaconda
xlrd                      1.2.0                    py37_0    anaconda
xz                        5.2.5                h1de35cc_0  
zipp                      3.1.0                      py_0    anaconda
zlib                      1.2.11               h1de35cc_3  

最后我打算在 Heroku 中部署应用程序,所以我认为可能需要 requirements.txt。

这是一种特殊语法(自 pip 19.1 起支持),用于从 VCS 存储库安装软件包:

package_name @ git+https://githost/<repo>.git@<commit_id>

https://pip.readthedocs.io/en/stable/reference/pip_install/#requirement-specifiers and https://www.python.org/dev/peps/pep-0440/#direct-references