pipenv如何决定我的python版本,以及为什么生成的requirement.txt与原始版本不同?
pipenv如何决定我的python版本?我的默认python3版本与pipenv决定的版本不同。一个简单的例子来说明我的问题。Pipefile说的是3.8,而我的python3是3.9pipenv如何决定我的python版本,以及为什么生成的requirement.txt与原始版本不同?,python,pipenv,Python,Pipenv,pipenv如何决定我的python版本?我的默认python3版本与pipenv决定的版本不同。一个简单的例子来说明我的问题。Pipefile说的是3.8,而我的python3是3.9 pyenv_test ➤ cat requirements.txt pexpect==4.8.0 termcolor==1.1.0 pyenv_test ➤ pipenv install re
pyenv_test ➤ cat requirements.txt
pexpect==4.8.0
termcolor==1.1.0
pyenv_test ➤ pipenv install
requirements.txt found, instead of Pipfile! Converting...
✔ Success!
Warning: Your Pipfile now contains pinned versions, if your requirements.txt did.
We recommend updating your Pipfile to specify the "*" version, instead.
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Updated Pipfile.lock (a46966)!
Installing dependencies from Pipfile.lock (a46966)...
Looking at the pipenv
docs on specifying a python version it states:
If you don’t specify a Python version on the command–line, either the [requires] python_full_version
or python_version
will be selected automatically, falling back to whatever your system’s default python installation is, at time of execution.
My guess is you initialized your pipenv
project before you upgraded to python 3.9.
If you do want to update your Pipfile
to specify your specific version of python you can simply:
pipenv --python 3.9
pyenv_测试➤ cat要求.txt
pexpect==4.8.0
termcolor==1.1.0
pyenv_试验➤ 管道安装
找到requirements.txt,而不是Pipfile!转换。。。
✔ 成功!
警告:如果您的requirements.txt包含固定版本,那么您的PIP文件现在包含固定版本。
我们建议您更新PIP文件以指定“*”版本。
找不到Pipfile.lock,正在创建。。。
正在锁定[开发包]依赖项。。。
正在锁定[程序包]依赖项。。。
建筑要求。。。
正在解析依赖项。。。
✔ 成功!
更新了Pipfile.lock(a46966)!
正在从Pipfile.lock(a46966)安装依赖项。。。
查看其上的pipenv
文档说明:
如果您没有在命令行上指定Python版本,则会自动选择[requires]Python\u full\u version
或Python\u version
,并在执行时返回到系统默认的Python安装
我猜您在升级到python 3.9之前初始化了pipenv
项目
如果要更新Pipfile
以指定特定的python版本,只需执行以下操作:
pipenv——python 3.9
当然,您也可以手动更新Pipfile中的python\u版本
我打开了一个针对pipenv的问题,在与一名维护人员讨论后,我现在明白了问题发生的原因
对于我的第一个问题,当运行pipenv安装时
pipenv重用了现有的python3.8版本,即不重新创建venv。我觉得这看起来像个问题,为什么要在新项目上重用venv
对于我的第二个问题,它确实帮助我理解“生成确定性构建”的含义。pexpect使用ptyprocess。我检查了pexpect的setup.py
因此,通过在requirement.txt中指定ptyprocess==0.6.0&pexpect==4.8.0
,确实产生了确定性构建。?哦,这是有意义的。但是,它仍然是pexpect的依赖关系,所以它不应该列在requirement.txtate中根据您的发现更新我的问题。因为您在requirements.txt中有它:pexpect==4.8.0。。。再次阅读pipenv的核心思想你刚才说了我的问题怎么样?python版本的问题是什么?恐怕不是这样的,因为我几天前运行了pip3安装pipenv来在python 3.9下安装pipenv。有趣的是,我刚刚通过pip3安装pipenv
确认了在安装了python 3.9.0和pipenv
之后,并运行pipenv安装
myPipfile
statespython\u version=“3.9”
。您是否安装了其他python版本?我在/usr/local/bin/python3.8中安装了3.8,但我使用的是3.9。在检查了我得到的评论之后,我做了一些其他的测试。我认为这是一个错误。所以我提出了一个问题,嗯。也许它在找到3.9之前在你的路径上找到了3.8?不管怎样,你提出的问题可能会给你一个更有成效的答案!因为我不熟悉pipenv,我认为可能是我做错了什么,所以我没有首先提出这个问题。我希望我的问题能得到一些答复。
install_requires=['ptyprocess>=0.5'],