【问题标题】:pip install packages failing: Invalid requirement & No matching distributionpip install packages 失败:无效的要求和没有匹配的分发
【发布时间】:2019-10-14 03:30:12
【问题描述】:

我正在尝试在 python 3.6.3 虚拟环境中安装软件包。我不断收到错误。

我尝试使用带有--ignore-installed 标志的 pip,例如:pip install -I -r package-list.txt

这是我在package-list.txt 中的部分内容。

# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
_libgcc_mutex==0.1==main
appdirs==1.4.3==pypi_0
asn1crypto==0.24.0==py36_0
beautifulsoup4==4.7.1==py36_1
blas==1.0==mkl
bzip2==1.0.6==h14c3975_5
ca-certificates==2019.6.16==hecc5488_0
cairo==1.14.12==h8948797_3
certifi==2019.6.16==py36_1
cffi==1.12.1==py36h2e261b9_0
chardet==3.0.4==py36_1
cloudpickle==0.8.0==pypi_0
cryptography==2.5==py36h1ba5d50_0
cycler==0.10.0==pypi_0
dask==1.1.4==pypi_0
decorator==4.4.0==pypi_0
ffmpeg==4.0==hcdf2ecd_0
fontconfig==2.13.0==h9420a91_0
freeglut==3.0.0==hf484d3e_5
freetype==2.9.1==h8a8886c_1
fuzzywuzzy==0.17.0==py_0
glib==2.56.2==hd408876_0
graphite2==1.3.13==h23475e2_0
harfbuzz==1.8.8==hffaf4a1_0
hdf5==1.10.2==hba1933b_1
icu==58.2==h9c2bf20_1
idna==2.8==py36_0
intel-openmp==2019.3==199
jasper==2.0.14==h07fcdf6_1
jpeg==9b==h024ee3a_2
kiwisolver==1.0.1==pypi_0
libedit==3.1.20181209==hc058e9b_0
libffi==3.2.1==hd88cf55_4
libgcc-ng==8.2.0==hdf63c60_1
libgfortran-ng==7.3.0==hdf63c60_0
libglu==9.0.0==hf484d3e_1
...

使用第一个包_libgcc_mutex==0.1==main 我收到此错误:

Ignoring pip: markers 'python_version < "3"' don't match your environment
ERROR: Invalid requirement: '_libgcc_mutex==0.1==main' (from line 4 of package-list3.txt)

没有_libgcc_mutex==0.1==main 我得到:

Ignoring pip: markers 'python_version < "3"' don't match your environment
Looking in links: /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/avx2, /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/generic
Collecting appdirs==1.4.3==pypi_0 (from -r package-list2.txt (line 4))
  ERROR: Could not find a version that satisfies the requirement appdirs==1.4.3==pypi_0 (from -r package-list2.txt (line 4)) (from versions: 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.4.1, 1.4.2, 1.4.3)
ERROR: No matching distribution found for appdirs==1.4.3==pypi_0 (from -r package-list2.txt (line 4))

【问题讨论】:

    标签: python-3.x pip conda requirements.txt virtual-environment


    【解决方案1】:

    您的文件在评论部分声明它应该与conda 一起使用,它不是requirements.txt 而是yml 文件。尝试使用文件中列出的命令:

    conda create --name <env> --file <this file>
    

    如果您想根据该文件修改当前环境,请尝试(在您的环境中):

    conda env update --file <your file>
    

    【讨论】:

    • 感谢您的回复。我已经在 python 3.6.3 虚拟环境中。我正在尝试在我的虚拟环境中安装此文件中的所有软件包。我认为conda create --name &lt;env&gt; --file &lt;this file&gt; 只会创建另一个虚拟环境,这不是我想要的。
    • 谢谢,这看起来是一个合理的解决方案。奇怪的是conda 没有安装在system/env 上。我在命令行中输入了conda,得到了command not found。服务器是多人共享​​的,包文件是别人创建的。我很好奇在系统上不存在conda 时如何创建文件。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-10
    • 2016-04-29
    • 2017-12-25
    • 2020-10-21
    • 2015-12-22
    • 2012-09-24
    相关资源
    最近更新 更多