Ad Code

Responsive Advertisement

Chuyển file py sang exec

Kiểm tra lại cài đặt PyInstaller

1.Đầu tiên, hãy chắc chắn rằng PyInstaller đã được cài đặt đúng cách. Thử chạy lại lệnh:

pip install --upgrade pyinstaller

  1. Mở Command Prompt (CMD): Nhấn Win + R, gõ cmd, sau đó nhấn Enter để mở Command Prompt.

  2. Di chuyển đến thư mục chứa file Python: Bạn cần chuyển đến thư mục chứa file m1.py. Sử dụng lệnh cd (change directory) để làm điều này:

  3. cd C:\Users\Adminkip\Desktop\phamemxemcamera

  4. Chạy lệnh PyInstaller: Nếu bạn đã cài đặt PyInstaller, chạy lệnh sau để chuyển file m1.py thành file .exe:

    bash
    pyinstaller --onefile m1.py

    Lệnh trên sẽ tạo một file .exe duy nhất. Bạn cũng có thể thêm --noconsole nếu không muốn cửa sổ dòng lệnh xuất hiện khi chạy ứng dụng:

    bash
    pyinstaller --onefile --noconsole m1.py
  5. Kiểm tra kết quả: Sau khi lệnh PyInstaller hoàn tất, bạn sẽ tìm thấy file .exe trong thư mục dist bên trong thư mục phamemxemcamera.

  6. Chạy file .exe: Bạn có thể mở thư mục dist và chạy file .exe tạo ra từ m1.py.


Đăng nhận xét

0 Nhận xét

Ad Code

Responsive Advertisement