python 为什么pip冻结并且不显示模块,尽管pip install说它已经安装了?

2ledvvac  于 2023-06-04  发布在  Python
关注(0)|答案(1)|浏览(412)

我正在关注these instructions以在Mac上安装Odoo。它要求我为用户安装所有Python模块,如下所示:

sudo pip install -—user -r requirements.txt

(* 关于--user部分的说明)
但是,当我运行Odoo时,我得到这个错误:

./odoo-bin

输出:

Traceback (most recent call last):
  File "./odoo-bin", line 5, in <module>
    __import__('pkg_resources').declare_namespace('odoo.addons')
  File "/Library/Python/2.7/site-packages/setuptools-36.5.0-py2.7.egg/pkg_resources/__init__.py", line 2241, in declare_namespace
  File "/Library/Python/2.7/site-packages/setuptools-36.5.0-py2.7.egg/pkg_resources/__init__.py", line 2257, in declare_namespace
  File "/Library/Python/2.7/site-packages/setuptools-36.5.0-py2.7.egg/pkg_resources/__init__.py", line 2192, in _handle_ns
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 246, in load_module
    mod = imp.load_module(fullname, self.file, self.filename, self.etc)
  File "/opt/odoo/odoo-10.0/odoo/__init__.py", line 64, in <module>
    import report
  File "/opt/odoo/odoo-10.0/odoo/report/__init__.py", line 5, in <module>
    from . import custom
  File "/opt/odoo/odoo-10.0/odoo/report/custom.py", line 20, in <module>
    from . import render
  File "/opt/odoo/odoo-10.0/odoo/report/render/__init__.py", line 4, in <module>
    from .simple import simple
  File "/opt/odoo/odoo-10.0/odoo/report/render/simple.py", line 8, in <module>
    import reportlab.lib
ImportError: No module named reportlab.lib

我注意到这个报告实验室在 requirements.txt 中可用:

reportlab==3.3.0

但是,如果我运行这个命令

pip freeze | grep reportlab

我什么也得不到,而且当我运行这个命令时

sudo pip install --user reportlab

我得到以下结果:

sudo pip install --user reportlab

输出:

The directory '/Users/odoo/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/odoo/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: reportlab in /Users/odoo/Library/Python/2.7/lib/python/site-packages
Requirement already satisfied: pillow>=2.4.0 in /Users/odoo/Library/Python/2.7/lib/python/site-packages (from reportlab)
Requirement already satisfied: pip>=1.4.1 in /Users/odoo/Library/Python/2.7/lib/python/site-packages (from reportlab)
Requirement already satisfied: setuptools>=2.2 in /Library/Python/2.7/site-packages/setuptools-36.5.0-py2.7.egg (from reportlab)
Requirement already satisfied: olefile in /Users/odoo/Library/Python/2.7/lib/python/site-packages (from pillow>=2.4.0->reportlab)

我已经尝试强制重新安装建议here,但没有做太多。
我该怎么解决这个问题?

vngu2lb8

vngu2lb81#

灵感来自dsgdfg的评论。我只是按照安装说明here。而且效果很好

更新

以上并不是一个好的解决方案,我不得不回去安装requirements.txt中提到的每个库!!我刚刚创建了一个虚拟环境,它运行顺利,从第一次尝试!

相关问题