适用于python的pipenv安装软件包无法正常运行

时间:2019-03-18 12:45:16

标签: python pip pipenv

我是Python的新手,因此我正在努力解决以下问题。我安装了 pip ,并进行了 pipenv 的用户安装,然后在项目文件夹中运行以下命令:

pipenv install requests

这给我一个错误,指出 pipenv命令错误或找不到

我在系统环境变量上添加了以下路径:

C:\Users\andri\AppData\Roaming\Python\Python37\Scripts

但仍然无法正常工作。有谁知道我接下来应该怎么做才能解决这个问题?预先感谢

更新:

我的操作系统是Windows。

这是我通过cmd安装pip的方式


C:\Users\andri>python -m pip install -U pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 1.5MB/s
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
Successfully installed pip-19.0.3

C:\Users\andri>pipenv install requests
Der Befehl "pipenv" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

C:\Users\andri>pip --version
pip 19.0.3 from c:\users\andri\appdata\local\programs\python\python37-32\lib\site-packages\pip (python 3.7)

C:\Users\andri>pip install --user pipenv
Collecting pipenv
  Downloading https://files.pythonhosted.org/packages/13/b4/3ffa55f77161cff9a5220f162670f7c5eb00df52e00939e203f601b0f579/pipenv-2018.11.26-py3-none-any.whl (5.2MB)
    100% |████████████████████████████████| 5.2MB 2.2MB/s
Requirement already satisfied: setuptools>=36.2.1 in c:\users\andri\appdata\local\programs\python\python37-32\lib\site-packages (from pipenv) (40.6.2)
Collecting virtualenv-clone>=0.2.5 (from pipenv)
  Downloading https://files.pythonhosted.org/packages/e3/d9/d9c56deb483c4d3289a00b12046e41428be64e8236fa210111a1f57cc42d/virtualenv_clone-0.5.1-py2.py3-none-any.whl
Collecting virtualenv (from pipenv)
  Downloading https://files.pythonhosted.org/packages/33/5d/314c760d4204f64e4a968275182b7751bd5c3249094757b39ba987dcfb5a/virtualenv-16.4.3-py2.py3-none-any.whl (2.0MB)
    100% |████████████████████████████████| 2.0MB 4.7MB/s
Requirement already satisfied: pip>=9.0.1 in c:\users\andri\appdata\local\programs\python\python37-32\lib\site-packages (from pipenv) (19.0.3)
Collecting certifi (from pipenv)
  Downloading https://files.pythonhosted.org/packages/60/75/f692a584e85b7eaba0e03827b3d51f45f571c2e793dd731e598828d380aa/certifi-2019.3.9-py2.py3-none-any.whl (158kB)
    100% |████████████████████████████████| 163kB 837kB/s
Installing collected packages: virtualenv-clone, virtualenv, certifi, pipenv
  The script virtualenv-clone.exe is installed in 'C:\Users\andri\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  The script virtualenv.exe is installed in 'C:\Users\andri\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  The scripts pipenv-resolver.exe and pipenv.exe are installed in 'C:\Users\andri\AppData\Roaming\Python\Python37\Scripts' 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 certifi-2019.3.9 pipenv-2018.11.26 virtualenv-16.4.3 virtualenv-clone-0.5.1

2 个答案:

答案 0 :(得分:1)

pip实际上正在帮助您警告这种情况……

  

脚本virtualenv-clone.exe安装在不在PATH上的'C:\ Users \ andri \ AppData \ Roaming \ Python \ Python37 \ Scripts'中。     考虑将此目录添加到PATH ...    脚本virtualenv.exe安装在不在PATH上的'C:\ Users \ andri \ AppData \ Roaming \ Python \ Python37 \ Scripts'中。     考虑将此目录添加到PATH ...    脚本pipenv-resolver.exe和pipenv.exe安装在PATH之外的'C:\ Users \ andri \ AppData \ Roaming \ Python \ Python37 \ Scripts'中。     考虑将该目录添加到PATH ...

您将需要添加该目录

  

C:\ Users \ andri \ AppData \ Roaming \ Python \ Python37 \ Scripts

到您的PATH环境变量;有很多方法可以做到,例如Adding directory to PATH Environment Variable in Windows

另一种选择是始终使用

C:\...> C:\Users\andri\AppData\Roaming\Python\Python37\Scripts\pipenv install

但是我认为这可能很快就会过时。

答案 1 :(得分:0)

  The script virtualenv.exe is installed in 'C:\Users\andri\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
  Consider adding this directory to PATH

有您的答案。 Scripts目录中没有包含针对每个用户安装的软件包的实用程序脚本,因此PATH不在您的命令外壳中,除非您添加它。

如果您是 just 通过控制面板将其添加到PATH,请参见windows - Why are changes to my PATH not being recognised? - Super User