我在Linux Mint Xfce 18.3(64位)上运行带有Python 3.5.5的Anaconda 64位。我想使用PyInstaller创建可执行文件。在努力完成PyInstaller安装(并非微不足道)之后,我运行了import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TitledPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
// Simple interface
VBox root = new VBox(5);
root.setPadding(new Insets(10));
root.setAlignment(Pos.CENTER);
// Create the TitlePane
TitledPane titledPane = new TitledPane();
titledPane.setAlignment(Pos.CENTER);
// Create HBox to hold our Title and button
HBox contentPane = new HBox();
contentPane.setAlignment(Pos.CENTER);
// Set padding on the left side to avoid overlapping the TitlePane's expand arrow
// We will also pad the right side
contentPane.setPadding(new Insets(0, 10, 0, 35));
// Now, since the TitlePane's graphic node generally has a fixed size, we need to bind our
// content pane's width to match the width of the TitledPane. This will account for resizing as well
contentPane.minWidthProperty().bind(titledPane.widthProperty());
// Create a Region to act as a separator for the title and button
HBox region = new HBox();
region.setMaxWidth(Double.MAX_VALUE);
HBox.setHgrow(region, Priority.ALWAYS);
// Add our nodes to the contentPane
contentPane.getChildren().addAll(
new Label("Titles Are Cool"),
region,
new Button("Click me!")
);
// Add the contentPane as the graphic for the TitledPane
titledPane.setGraphic(contentPane);
// Add the pane to our root layout
root.getChildren().add(titledPane);
// Show the Stage
primaryStage.setWidth(400);
primaryStage.setHeight(300);
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
}
,其中test_built.py仅由
#include <Adafruit_CircuitPlayground.h>
#include <Wire.h>
#include <SPI.h>
#define CLICKTHRESHHOLD 120
int registry=1; //set initial move
void setup(void) {
while (!Serial);
Serial.begin(9600);
CircuitPlayground.begin();
}
void printAxis() {
float x, y, z;
x = CircuitPlayground.motionX();
y = CircuitPlayground.motionY();
z = CircuitPlayground.motionZ();
Serial.print("X: ");
Serial.print(x);
Serial.print(" Y: ");
Serial.print(y);
Serial.print(" Z: ");
Serial.println(z);
}
void tap() {
CircuitPlayground.playTone(50, 100);
Serial.print("Registry Number: " );
Serial.println(registry);
printAxis();
registry++;
}
void loop() {
// Only take action when either button is pressed.
if ( (CircuitPlayground.leftButton() == true) ) {
CircuitPlayground.setAccelRange(LIS3DH_RANGE_2_G);
// Tapping function
CircuitPlayground.setAccelTap(1, CLICKTHRESHHOLD);
// have a procedure called when a tap is detected
attachInterrupt(digitalPinToInterrupt(7), tap, RISING);
}
}
我没有收到任何意外的警告或错误(当然,如果我之前做过,则会覆盖文件夹)。我 Serial.print("Delaying...");
delay(2000);
Serial.print("Delay ready!");
进入pyinstaller test_build.py
并运行print("Hello, world!")
,出现以下错误:
cd
有什么想法吗?非常感谢您的宝贵时间!