我很难让 Python 找到我的 module romodel
的 pip 安装。这是我到目前为止所做的:
检查了我的 python 路径使用的是什么
which python
:/Users/<username>/opt/anaconda3/bin/python
使用 pip 安装:
/Users/<username>/opt/anaconda3/bin/python -m pip install romodel
卸载现有的(可能没有改变任何东西):
pip3 uninstall romodel
启动
python
,并试图找到romodel包:import romodel Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'romodel'
我确保
romodel
安装位置在路径中:ls /Users/<username>/opt/anaconda3/lib/python3.9/site-packages/ |grep "romodel"
romodel-0.0.1.dist-info
所以,我启动
python
并手动将包位置添加到路径中:import sys
sys.path.append('/Users/<username>/opt/anaconda3/lib/python3.9/site-packages/')
但是,仍然没有找到 module:
import romodel Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'romodel'
我有什么明显的遗漏吗?根据下面列出的资源,我希望上述过程能够奏效。
我使用了以下资源:
https://realpython.com/lessons/why-cant-python-find-my-modules/
https://stackoverflow.com/questions/40834656/installed-module-using-pip-not-found
还有我自己之前的问题:https://stackoverflow.com/questions/39187374/how-to-correctly-uninstall-numpy-on-macosx
回答1
根据此处的说明:https://pypi.org/project/romodel/,我错误地尝试通过 pip install romodel
安装 romodel
。截至 2022 年 5 月,这不是安装 romodel 的方式。
但是,安装 romodel
的正确方法是按照此处的说明进行操作:https://github.com/cog-imperial/romodel:
pip install git+https://github.com/cog-imperial/romodel.git