即使有Python包也没有找到

问题描述 投票:1回答:1

我下载了python软件包“ swagger-client”以便与网站的API进行交互(swagger是一种用于自动进行API的客户端/服务器通信的框架)。然后,我使用以下方法安装了swagger-client软件包:

./venv/bin/python python-client/setup.py install

我可以看到该软件包已部署在

venv / lib / python3.7 / site-packages / swagger_client-1.0.0-py3.7.egg

[此外,我的IDE PyCharm还显示swagger-client程序包已“找到”:enter image description hereenter image description here

但是,当我尝试使用“ import swagger_client”导入软件包时,出现错误<class 'tuple'>: (<class 'ModuleNotFoundError'>, ModuleNotFoundError("No module named 'swagger_client'"), <traceback object at 0x7fd74cac4948>)

我在做什么错?

python swagger swagger-codegen
1个回答
1
投票

看来我用来安装swagger_client模块的方法是错误的。

我用过:

./venv/bin/python3.7 python-client/setup.py install

产生此警告:

warning: install_lib: 'build/lib' does not exist -- no Python modules to install

但是这是正确的方法:

cd python-client
../venv/bin/python3.7 setup.py install
© www.soinside.com 2019 - 2024. All rights reserved.