为什么pip安装包不会出现在pip冻结中?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了为什么pip安装包不会出现在pip冻结中?相关的知识,希望对你有一定的参考价值。
我想通过pip安装this package。当我运行pip install flask-googlemaps
时,我看到通常的输出,并且包已成功安装,以及一些依赖项。如果我然后运行pip freeze
,我会看到列出的所有依赖项,但不是包本身。为什么?
这是我的流程的全面细分。我测试了一个新鲜的virtualenv,以确保我不只是错过它。
$ mkvirtualenv test1
New python executable in /Users/me/.virtualenvs/test1/bin/python2.7 Also creating executable in /Users/me/.virtualenvs/test1/bin/python Installing setuptools, pip, wheel...done. virtualenvwrapper.user_scripts creating /Users/me/.virtualenvs/test1/bin/predeactivate virtualenvwrapper.user_scripts creating /Users/me/.virtualenvs/test1/bin/postdeactivate virtualenvwrapper.user_scripts creating /Users/me/.virtualenvs/test1/bin/preactivate virtualenvwrapper.user_scripts creating /Users/me/.virtualenvs/test1/bin/postactivate virtualenvwrapper.user_scripts creating /Users/me/.virtualenvs/test1/bin/get_env_details
$ pip freeze
(no results, because nothing has been installed yet)
$ pip install flask-googlemaps
Collecting flask-googlemaps Using cached Flask_GoogleMaps-0.2.5-py2.py3-none-any.whl Collecting flask (from flask-googlemaps) Using cached Flask-0.12.2-py2.py3-none-any.whl Collecting Werkzeug>=0.7 (from flask->flask-googlemaps) Using cached Werkzeug-0.12.2-py2.py3-none-any.whl Collecting Jinja2>=2.4 (from flask->flask-googlemaps) Using cached Jinja2-2.9.6-py2.py3-none-any.whl Collecting click>=2.0 (from flask->flask-googlemaps) Using cached click-6.7-py2.py3-none-any.whl Collecting itsdangerous>=0.21 (from flask->flask-googlemaps) Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->flask->flask-googlemaps) Installing collected packages: Werkzeug, MarkupSafe, Jinja2, click, itsdangerous, flask, flask-googlemaps Successfully installed Jinja2-2.9.6 MarkupSafe-1.0 Werkzeug-0.12.2 click-6.7 flask-0.12.2 flask-googlemaps itsdangerous-0.24
$ pip freeze
click==6.7 Flask==0.12.2 itsdangerous==0.24 Jinja2==2.9.6 MarkupSafe==1.0 Werkzeug==0.12.2
请注意,flask-googlemaps不包含在第二个pip冻结输出中,但它的所有依赖项都是。
更奇怪的是,我现在可以完全使用该软件包。它已安装,它只是没有显示在pip冻结输出中。
花了一些时间,但我追查了它。
如果你跑
pip install -v flask-googlemaps
你会在最后看到
Installing collected packages: Werkzeug, MarkupSafe, Jinja2, click, itsdangerous, flask, flask-googlemaps
Compiling /private/var/folders/2h/0dr8jftd1916yq_lp40__wzh0000gn/T/pip-build-avapA_/Jinja2/jinja2/asyncfilters.py ...
File "/private/var/folders/2h/0dr8jftd1916yq_lp40__wzh0000gn/T/pip-build-avapA_/Jinja2/jinja2/asyncfilters.py", line 7
async def auto_to_seq(value):
^
SyntaxError: invalid syntax
Compiling /private/var/folders/2h/0dr8jftd1916yq_lp40__wzh0000gn/T/pip-build-avapA_/Jinja2/jinja2/asyncsupport.py ...
File "/private/var/folders/2h/0dr8jftd1916yq_lp40__wzh0000gn/T/pip-build-avapA_/Jinja2/jinja2/asyncsupport.py", line 22
async def concat_async(async_gen):
^
SyntaxError: invalid syntax
为了证明这个错误是烧瓶谷歌地图没有出现在pip冻结的原因,我安装了以前的版本。
pip install flask-googlemaps==0.2.4
Collecting flask-googlemaps==0.2.4
Collecting Flask (from flask-googlemaps==0.2.4)
Using cached Flask-0.12.2-py2.py3-none-any.whl
Collecting Werkzeug>=0.7 (from Flask->flask-googlemaps==0.2.4)
Using cached Werkzeug-0.12.2-py2.py3-none-any.whl
Collecting Jinja2>=2.4 (from Flask->flask-googlemaps==0.2.4)
Using cached Jinja2-2.9.6-py2.py3-none-any.whl
Collecting click>=2.0 (from Flask->flask-googlemaps==0.2.4)
Using cached click-6.7-py2.py3-none-any.whl
Collecting itsdangerous>=0.21 (from Flask->flask-googlemaps==0.2.4)
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->Flask->flask-googlemaps==0.2.4)
Installing collected packages: Werkzeug, MarkupSafe, Jinja2, click, itsdangerous, Flask, flask-googlemaps
Successfully installed Flask-0.12.2 Jinja2-2.9.6 MarkupSafe-1.0 Werkzeug-0.12.2 click-6.7 flask-googlemaps-0.2.4 itsdangerous-0.24
Pip冻结现在有效
pip freeze
click==6.7
Flask==0.12.2
Flask-GoogleMaps==0.2.4
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
Werkzeug==0.12.2
我刚刚代表你提交了GitHub issue。
馄饨,
有趣的是你遇到了这个问题。我正在使用python 3.6并且没有运行错误
pip install -v flask-googlemaps
它完全安装,我可以使用该包。
我做了一点点戳,这是我发现的:
site-packages为flask-googlemaps提供以下条目
flask_googlemaps
Flask-GoogleMaps-0.2.5-dist-info
通过简单地重命名Flask-GoogleMaps-0.2.5-dist-info以匹配flask_googlemap的格式,我能够获得pip冻结以显示flask-googlemaps:
davidj> mv Flask-GoogleMaps-0.2.5.dist-info Flask_GoogleMaps-0.2.5.dist-info
davidj> pip freeze
clickk==6.7
Flask==0.12.2
Flask-GoogleMaps==0.2.5
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
pkg-resources==0.0.0
Werkzeug==0.12.2
在这之后,所有的pip函数都适用于包。
也许pip有一些必要的命名约定来将info目录映射到包目录....
如果您安装了多个版本的python,则pip可能会有与版本相关的意外行为。确保明确使用pip2 install
或pip3 install
,以及pip2 freeze
或pip3 freeze
来匹配您打算使用的python版本。
(注意:这个答案可能与OP的情况无关,但对于其他一些案例,回答了“为什么pip安装包不会出现在pip冻结?”的问题。)
以上是关于为什么pip安装包不会出现在pip冻结中?的主要内容,如果未能解决你的问题,请参考以下文章