简体   繁体   English

如何在 Python 中安装 dbconnect 模块?

[英]How can I install the dbconnect module in Python?

I am VERY new to python (as in I just started yesterday, but I have used R in the past) and I'm trying to install this module ( https://github.com/CellProfiler/CellProfiler-Analyst/find/master ) but in order for me to do that I have to install a number of other modules first that this module cites like properties, verlib and pickle5.我对 python 非常陌生(就像我昨天刚开始一样,但我过去使用过 R)并且我正在尝试安装这个模块( Z5E056C500A1C4B6A7110B50D807/BADEProfile-AnalyCellst/finr. ) 但为了让我这样做,我必须首先安装该模块引用的许多其他模块,例如属性、verlib 和 pickle5。 I get to one called dbconnect and do the same command as usual我找到一个名为 dbconnect 的命令,并像往常一样执行相同的命令

pip install dbconnect pip 安装数据库连接

And I get the same message that dbconnect has been installed我得到了同样的消息,dbconnect 已安装

Collecting dbconnect收集 dbconnect

Using cached dbConnect-2.1-py2.py3-none-any.whl (12 kB)使用缓存的 dbConnect-2.1-py2.py3-none-any.whl (12 kB)

Requirement already satisfied: setuptools in./opt/anaconda3/envs/threeseven/lib/python3.7/site-packages (from dbconnect) (52.0.0.post20210125)已满足要求:/opt/anaconda3/envs/threeseven/lib/python3.7/site-packages 中的 setuptools(来自 dbconnect)(52.0.0.post20210125)

Installing collected packages: dbconnect安装收集的包:dbconnect

Successfully installed dbconnect-2.1成功安装dbconnect-2.1

But then when I try to use py2app to install the github module to see which other modules I need to install I get this error message despite having installed dbconnect但是,当我尝试使用 py2app 安装 github 模块以查看我需要安装哪些其他模块时,尽管安装了 dbconnect,但仍收到此错误消息

ModuleNotFoundError: No module named 'dbconnect' ModuleNotFoundError:没有名为“dbconnect”的模块

I've tried uninstalling and reinstalling dbconnect in several virtual environments using Anaconda but I still get the same error.我尝试使用 Anaconda 在几个虚拟环境中卸载并重新安装 dbconnect,但我仍然遇到相同的错误。 I could try installing different versions of dbconnect but wanted to see what you thought before trying.我可以尝试安装不同版本的 dbconnect,但在尝试之前想看看您的想法。 Thanks everyone!感谢大家!

pip install dbconnect installs wrong dbconnect . pip install dbconnect安装错误的dbconnect Right dbconnect is inside package cpa and it should be installed along with the very CellProfiler-Analyst .dbconnect位于package cpa内,它应该与CellProfiler-Analyst一起安装。 The problem is that cpa/__init__.py imports it using relative import: import dbconnect .问题是cpa/__init__.py使用相对导入导入它: import dbconnect This is Python2-style import, it doesn't work in Python 3.这是 Python2 风格的导入,它在 Python 3 中不起作用。

Let's us look into the docs: https://github.com/CellProfiler/CellProfiler-Analyst/wiki#source-code .让我们看看文档: https://github.com/CellProfiler/CellProfiler-Analyst/wiki#source-code Python 3 is not mentioned, only Python 2.7. Python 3 没有提到,只有 Python 2.7。

The bottom line: the code is only for Python 2.7.底线:代码仅适用于 Python 2.7。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM