【问题标题】:Unable to locate package python-pytest无法找到包 python-pytest
【发布时间】:2021-12-16 05:43:58
【问题描述】:

我最近不得不重置我的机器,所以必须重新安装所有东西。

我想使用PyTest 运行Python 文件。

Bash 终端:

me@PF2DCSXD:/mnt/c/Users/dabell/Documents/GitHub/workers-python/workers/composite_key/compositekey/tests$ pytest -s test_composite_key.py

Command 'pytest' not found, but can be installed with:

sudo apt install python-pytest

me@PF2DCSXD:/mnt/c/Users/dabell/Documents/GitHub/workers-python/workers/composite_key/compositekey/tests$ sudo apt install python-pytest
[sudo] password for danielbellhv: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python-pytest

我能够安装pip,按照这篇文章的Solution

如果还有什么我可以添加到帖子中的,请告诉我。

【问题讨论】:

    标签: python installation package dependencies pytest


    【解决方案1】:

    我必须先安装 pip,如here:

    sudo apt-get update
    sudo apt-get upgrade  #Optional
    sudo apt install python3-pip
    

    然后

    $ pip install pytest
    Collecting pytest
      Downloading pytest-6.2.5-py3-none-any.whl (280 kB)
         |████████████████████████████████| 280 kB 621 kB/s 
    Collecting packaging
      Downloading packaging-21.2-py3-none-any.whl (40 kB)
         |████████████████████████████████| 40 kB 1.1 MB/s 
    Collecting iniconfig
      Downloading iniconfig-1.1.1-py2.py3-none-any.whl (5.0 kB)
    Collecting pluggy<2.0,>=0.12
      Downloading pluggy-1.0.0-py2.py3-none-any.whl (13 kB)
    Collecting py>=1.8.2
      Downloading py-1.10.0-py2.py3-none-any.whl (97 kB)
         |████████████████████████████████| 97 kB 1.1 MB/s
    Collecting toml
      Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
    Requirement already satisfied: attrs>=19.2.0 in /usr/lib/python3/dist-packages (from pytest) (19.3.0)
    Collecting pyparsing<3,>=2.0.2
      Downloading pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
         |████████████████████████████████| 67 kB 1.1 MB/s
    Installing collected packages: pyparsing, packaging, iniconfig, pluggy, py, toml, pytest
      WARNING: The scripts py.test and pytest are installed in '/home/danielbellhv/.local/bin' which is not on PATH.
      Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
    Successfully installed iniconfig-1.1.1 packaging-21.2 pluggy-1.0.0 py-1.10.0 pyparsing-2.4.7 pytest-6.2.5 toml-0.10.2
    

    注意:

    $ pip install python-pytest
    ERROR: Could not find a version that satisfies the requirement python-pytest (from versions: none)
    ERROR: No matching distribution found for python-pytest
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-01-31
      • 2020-09-10
      • 1970-01-01
      • 1970-01-01
      • 2022-07-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多