Psycopg2错误:找不到符号_PQbackendPID

时间:2018-10-12 00:46:37

标签: python pip psycopg2

我从psycopg2收到以下错误:

public class InlineGettingStartedCodeSampleApp {


public static void main(String[] args) {
AWSCredentials credentials = null;
try {
    credentials = new ProfileCredentialsProvider("Assignment3").getCredentials();
} catch (Exception e) {
    throw new AmazonClientException(
            "Cannot load the credentials from the credential profiles file and is in valid format.", e);
}
AmazonEC2 ec2 = AmazonEC2ClientBuilder.standard()
    .withCredentials(new AWSStaticCredentialsProvider(credentials))
    .withRegion(Regions.AP_SOUTHEAST_2)
    .build();

RequestSpotInstancesRequest requestRequest = new RequestSpotInstancesRequest();

// Request 1 x t1.micro instance with a bid price of $0.03.
requestRequest.setSpotPrice("0.03");
requestRequest.setInstanceCount(Integer.valueOf(1));

LaunchSpecification launchSpecification = new LaunchSpecification();
launchSpecification.setImageId("ami-fd9cecc7");
launchSpecification.setInstanceType("t1.micro");

System.out.println("set image");
// Add the security group to the request.
ArrayList<String> securityGroups = new ArrayList<String>();
securityGroups.add("GettingStartedGroup");
launchSpecification.setSecurityGroups(securityGroups);

// Add the launch specifications to the request.
requestRequest.setLaunchSpecification(launchSpecification);

// Call the RequestSpotInstance API.
System.out.println("Calling API");
RequestSpotInstancesResult requestResult = ec2.requestSpotInstances(requestRequest); // Dies here
System.out.println("API called");    

关于如何解决此问题的任何建议?

1 个答案:

答案 0 :(得分:0)

我在macOS上也遇到了同样的问题,并通过执行以下步骤解决了该问题:

  • pip卸载psycopg2
  • pip安装psycopg2-binary