本文介绍了适用于Boto3的PyCharm intellisense的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PyCharm中看到完整的智能感知(代码完成)选项时遇到问题.在Windows上使用python 3.4.提示部分起作用:

having problems seeing full intellisense (code completion) options in PyCharm.working with python 3.4 on Windows.the suggests are partially working:

import boto3
s = boto3.Session()  (boto3. will bring up list of methods/params of object boto3)
ec2 = s.resource('ec2') (resource is a suggested method!)
ec2. <<<< this brings up nothing. For some reason PyCharm cant detect that ec2 object would have 

虽然我可以单独处理文档,但是intellisense就是一个很好的功能!

while I can work off documentation alone, intellisense is just such a nice feature to have!

ive在完成lxml语法时遇到类似的问题,但是我认为这是因为我必须直接将lxml作为二进制文件安装(太多的循环无法在Windows上跳过以通过pip安装它)

ive had similar problems getting it to complete lxml syntax but I thought that was because I had to install lxml directly as a binary (too many hoops to jump through on windows to install it via pip)

还有其他人遇到类似的问题吗?

Anyone else encounter similar problems?

虽然我们在这里,我在使用awscli和python的过程中看到很多不同的库:boto,boto3,对流层等.使用一个库比使用另一个库有什么优势.亚马逊表示,与boto相比,boto3是首选的方法,但是对于我来说,启动/停止ec2实例的使用可以通过较早的boto轻松完成.

While we are here,I see a lot of different libraries around using awscli with python: boto, boto3, troposphere etc. What are some advantages of using one over the other. Amazon states that boto3 is the prefered method over boto but for my usage of starting/stopping ec2 instances could be easily done with older boto.

推荐答案

之所以会发生这种情况,是因为boto3客户端和资源对象上的所有方法都是在运行时根据描述服务支持的JSON文件生成的.为了自动完成方法名称,Pycharm必须具有有关此过程的特定知识.

This is happening because all of the methods on the boto3 clients and resource objects are generated at runtime based on a JSON file that describes what operations the service supports. Pycharm would have to have specific knowledge about this process in order to auto complete method names.

对于第二个问题,boto3是适用于Python的官方AWS开发工具包. boto3的主要优点之一是,由于此描述AWS API的JSON模型驱动过程,因此大多数新服务功能仅需要简单的模型更新.这意味着API更新将以快速,一致和可靠的方式进行.

For your second question, boto3 is the official AWS SDK for Python. One of the main advantages of boto3 is that because of this JSON model driven process that describes the AWS APIs, most new service features only require a simple model update. This means API updates happen in a quick, consistent, and reliable manner.

但是,如果您在现有代码中使用boto并且对您有用,请随时继续使用它.如果您需要引入新功能,则始终可以在boto旁边安装boto3.

But if you're using boto in existing code and it's working for you, feel free to keep using it. You can always install boto3 along side boto if you need to pull in new functionality.

这篇关于适用于Boto3的PyCharm intellisense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 07:14