admin管理员组文章数量:1315792
Just came across a very weird behavior of pipenv that I don't quite understand.
Here is my environment
- Running terminal and iTerm2 under Rosetta
- Python 3.11.9 installed via Pyenv (2.4.8) and set as global
pyenv global 3.9.11
- Another Python 3.11.9 installed using the package downloaded directly from python's official website
I setup a experiment project and it anized as following
/dependencyExp_01/
|--app.py
|--Pipfile
where Pipfile
is
[[source]]
url = ";
verify_ssl = true
name = "pypi"
[packages]
packaging = "*"
typing_extensions = "*"
[dev-packages]
and app.py
is
from packaging.version import Version
print("something")
I installed the dependency uisng $ pipenv install
-------- All the commands down below are executed under virtual environment --------
Then $ pip list
and you can see that packaging
is not in the list
Package Version
---------- -------
pip 24.3.1
setuptools 75.6.0
wheel 0.45.1
Also, $ pipenv graph
, packaging
is in the list
importlib-metadata==8.0.0
- zipp [required: >=0.5, installed: 3.19.2]
jaraco.collections==5.1.0
- jaraco.text [required: Any, installed: 3.12.1]
- autocommand [required: Any, installed: 2.2.2]
- inflect [required: Any, installed: 7.3.1]
- more-itertools [required: >=8.5.0, installed: 10.3.0]
- typeguard [required: >=4.0.1, installed: 4.3.0]
- typing-extensions [required: >=4.10.0, installed: 4.12.2]
- jaraco.context [required: >=4.1, installed: 5.3.0]
- backports.tarfile [required: Any, installed: 1.2.0]
- jaraco.functools [required: Any, installed: 4.0.1]
- more-itertools [required: Any, installed: 10.3.0]
- more-itertools [required: Any, installed: 10.3.0]
packaging==24.2
tomli==2.0.1
However, when I try to run app.py
I got this
(dependencyExp_01) jingwang@jing-MacBook-Pro dependencyExp_01 % python app.py
Traceback (most recent call last):
File "/Users/jingwang/Documents/PythonProject/dependencyExp_01/app.py", line 1, in <module>
from packaging.version import Version
ModuleNotFoundError: No module named 'packaging'
Then I installed packaging
using $ pip install packaging
After $ pip list
I get, packaging
appears in the list
Package Version
---------- -------
packaging 24.2
pip 24.3.1
setuptools 75.6.0
wheel 0.45.1
Also, $ pipenv graph
, the graph is the same as that before the pip install
importlib-metadata==8.0.0
- zipp [required: >=0.5, installed: 3.19.2]
jaraco.collections==5.1.0
- jaraco.text [required: Any, installed: 3.12.1]
- autocommand [required: Any, installed: 2.2.2]
- inflect [required: Any, installed: 7.3.1]
- more-itertools [required: >=8.5.0, installed: 10.3.0]
- typeguard [required: >=4.0.1, installed: 4.3.0]
- typing-extensions [required: >=4.10.0, installed: 4.12.2]
- jaraco.context [required: >=4.1, installed: 5.3.0]
- backports.tarfile [required: Any, installed: 1.2.0]
- jaraco.functools [required: Any, installed: 4.0.1]
- more-itertools [required: Any, installed: 10.3.0]
- more-itertools [required: Any, installed: 10.3.0]
packaging==24.2
tomli==2.0.1
Now when I run the app.py
again, the error is gone and I can see the text printed out
(dependencyExp_01) jingwang@jing-MacBook-Pro dependencyExp_01 % python app.py
something
(dependencyExp_01) jingwang@jing-MacBook-Pro dependencyExp_01
Currently the workaround is to install those missing packages separately using $ pip install <whatever>
, however, it's quite annoying. It would less hassle if pipenv install
can take care of it. I don't know why it behaves like that, can anyone help here? Thanks
本文标签: pythonPackages do not show up in the list after running pipenv installStack Overflow
版权声明:本文标题:python - Packages do not show up in the list after running `pipenv install` - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741988456a2408825.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论