在Windows上安装pipenv失败

2024-05-23 14:24:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在与Django Heroku模板网站工作。我想在我的Windows计算机上使用这个网站,使用Heroku和Python的一个要求就是要有pipenv(这个项目有一个Pipfile)。

为了在Windows上安装pipenv,我在cmd终端中尝试了两个命令,这两个命令给出了大致相同的错误:

pip install pipenv

结果

Collecting pipenv
  Using cached pipenv-11.9.0.tar.gz
    Complete output from command python setup.py egg_info:
    error in pipenv setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected version spec in pathlib;python_version<"3.4" at ;python_version<"3.4"

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\myUserName\AppData\Local\Temp\pip-build-267yrlop\pipenv\

以及:

easy_install -U pipenv

结果

Searching for pipenv
Reading https://pypi.python.org/simple/pipenv/
Best match: pipenv 11.9.0
Downloading https://pypi.python.org/packages/aa/43/e7426676c659fa3c1db28653ceee3571efbaaec2d2795bca00212989268a/pipenv-11.9.0.tar.gz#md5=0cdefd8434dc2b30415708d517730dcb
Processing pipenv-11.9.0.tar.gz
Writing C:\Users\myUserName\AppData\Local\Temp\easy_install-p2bvwljy\pipenv-11.9.0\setup.cfg
Running pipenv-11.9.0\setup.py -q bdist_egg --dist-dir C:\Users\myUserName\AppData\Local\Temp\easy_install-p2bvwljy\pipenv-11.9.0\egg-dist-tmp-vfore9pv
error: Setup script exited with error in pipenv setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected version spec in pathlib;python_version<"3.4" at ;python_version<"3.4"

我不太明白这个错误信息。pipenv的安装脚本中似乎有一个错误,但很可能没有。或者它期望的Python版本低于3.4?(如果是,我该如何在Python 3.5中安装它?)

编辑:我试过管理权限,在virtualenv中进出,但结果是一样的。


Tags: installinpyeggversionlocalpipenvsetup
2条回答

我认为这与setuptools或pip的过时版本有关。首先尝试使用更新setuptools

pip install --upgrade setuptools

然后安装pipenv

pip install pipenv

如果仍然失败,请尝试用

pip install --upgrade pip

或者(因为你提到你在Windows上)

python -m pip install --upgrade pip

here那里得到的

On Windows you can find the user base binary directory by running py -m site --user-site and replacing site-packages with Scripts. For example, this could return C:\Users\Username\AppData\Roaming\Python36\site-packages so you would need to set your PATH to include C:\Users\Username\AppData\Roaming\Python36\Scripts. You can set your user PATH permanently in the Control Panel. You may need to log out for the PATH changes to take effect.

我无法在计算机上生成此文件,但如果可能的话,请使用anaconda它预先安装了许多库

相关问题 更多 >