社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Python

python的pipenv安装包不工作

ffblord • 5 年前 • 1709 次点击  

我是Python新手,因此正在努力解决以下问题。我安装了 皮普 我让用户安装了 皮涅夫 然后在项目文件夹上运行命令:

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
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/52590
 
1709 次点击  
文章 [ 2 ]  |  最新文章 5 年前
ivan_pozdeev
Reply   •   1 楼
ivan_pozdeev    6 年前
  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 ,因此除非添加命令shell,否则命令shell将找不到它们。

如果你有 只是 添加到 路径 通过控制面板,请参见 windows - Why are changes to my PATH not being recognised? - Super User

AKX
Reply   •   2 楼
AKX    6 年前

pip 实际上是在提醒你这件事。。。

脚本virtualenv-clone.exe安装在不在路径上的“C:\Users\andri\AppData\Roaming\Python\Python37\Scripts”中。 考虑将此目录添加到路径。。。 脚本virtualenv.exe安装在不在路径上的“C:\Users\andri\AppData\Roaming\Python\Python37\Scripts”中。 考虑将此目录添加到路径。。。 脚本pipenv-resolver.exe和pipenv.exe安装在不在路径上的“C:\Users\andri\AppData\Roaming\Python\Python37\scripts”中。 考虑将此目录添加到路径。。。

您需要添加该目录

C: \Users\andri\AppData\Roaming\Python\Python37\脚本

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

另一种选择是总是使用

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

但我认为这可能会很快变得有点陈腐。