Run this program as an administrator; Now browse for a “.exe” file named “GameOverlayUI.exe”. You should right-click on it and select Properties from the list of options. Select the Compatibility tab from the top of the screen. At the bottom of the small window, you will see a checkbox which says “Run this program as an administrator”.
The syntax of the
pyinstaller command is:
pyinstaller [options] script [script …] | specfile
In the most simple case,set the current directory to the location of your program
myscript.py and execute:
PyInstaller analyzes
myscript.py and:
In the
dist folder you find the bundled app you distribute to your users.
Normally you name one script on the command line.If you name more, all are analyzed and included in the output.However, the first script named supplies the name for thespec file and for the executable folder or file.Its code is the first to execute at run-time.
For certain uses you may edit the contents of
myscript.spec (described under Using Spec Files).After you do this, you name the spec file to PyInstaller instead of the script:
pyinstallermyscript.spec
The
myscript.spec file contains most of the informationprovided by the options that were specified whenpyinstaller (or pyi-makespec)was run with the script file as the argument.You typically do not need to specify any options when runningpyinstaller with the spec file.Only a few command-line optionshave an effect when building from a spec file.
You may give a path to the script or spec file, for example
or, on Windows,
pyinstaller'C:DocumentsandSettingsprojectmyscript.spec'
Options¶General Options¶
What to generate¶
What to bundle, where to search¶
How to generate¶
Windows and Mac OS X specific options¶
Windows specific options¶
Windows Side-by-side Assembly searching options (advanced)¶
Mac OS X specific options¶
Mac How To Run App As AdministratorRarely used special options¶
Shortening the Command¶
Because of its numerous options, a full
pyinstaller commandcan become very long.You will run the same command again and again as you developyour script.You can put the command in a shell script or batch file,using line continuations to make it readable.For example, in GNU/Linux:
Or in Windows, use the little-known BAT file line continuation:
Running PyInstaller from Python code¶
If you want to run PyInstaller from within Python code use the
run function of the __main__ module and pass all command line arguments in asa list, e.g.
Running PyInstaller with Python optimizations¶
Note
When using this feature, you should be aware of how the Python bytecodeoptimization mechanism works. When using
-O , __debug__ is setto False and assert statements are removed from the bytecode.The -OO flag additionally removes docstrings.
Using this feature affects not only your main script, but all modulesincluded by PyInstaller. If your code (or any module imported by yourscript) relies on these features, your program may break or haveunexpected behavior.
PyInstaller can be run with Python optimization flags (
-O or -OO )by executing it as a Python module, rather than using the pyinstaller command:
Or, by explicitly setting the
PYTHONOPTIMIZE environment variableto a non-zero value:
You can use any PyInstaller options that are otherwise available withthe
pyinstaller command. For example:
Alternatively, you can also use the path to pyinstaller:
Using UPX¶
UPX is a free utility available for most operating systems.UPX compresses executable files and libraries, making them smaller,sometimes much smaller.UPX is available for most operating systems and can compressa large number of executable file formats.See the UPX home page for downloads, and for the list ofsupported executable formats.
A compressed executable program is wrapped in UPXstartup code that dynamically decompresses the programwhen the program is launched.After it has been decompressed, the program runs normally.In the case of a PyInstaller one-file executable that hasbeen UPX-compressed, the full execution sequence is:
PyInstaller looks for UPX on the execution pathor the path specified with the
--upx-dir option.If UPX exists, PyInstaller applies it to the final executable,unless the --noupx option was given.UPX has been used with PyInstaller output often, usually with no problems.
Encrypting Python Bytecode¶
To encrypt the Python bytecode modules stored in the bundle,pass the
--key= key-string argument onthe command line.
For this to work, you need to run:
The key-string is a string of 16 characters which is used toencrypt each file of Python byte-code before it is stored inthe archive inside the executable file.
This feature uses the tinyaes module internally for the encryption.
Defining the Extraction Location¶
In rare cases, when you bundle to a single executable(see Bundling to One File and How the One-File Program Works),you may want to control the location of the temporary directory at compiletime. This can be done using the
--runtime-tmpdir option. If this option isgiven, the bootloader will ignore any temp-folder location defined by therun-time OS. Please use this option only if you know what you are doing.
Supporting Multiple Platforms¶
If you distribute your application for only one combination of OS and Python,just install PyInstaller like any other package and use it in yournormal development setup.
Supporting Multiple Python Environments¶
When you need to bundle your application within one OSbut for different versions of Python and support libraries – for example,a Python 3.6 version and a Python 3.7 version;or a supported version that uses Qt4 and a development version that uses Qt5 –we recommend you use venv.With venv you can maintain different combinations of Pythonand installed packages, and switch from one combination to another easily.These are called virtual nvironments or venvs in short.
Note that when using venv, the path to the PyInstaller commands is:
Under Windows, the pip-Win package makes itespecially easy to set up different environments and switch between them.Under GNU/Linux and Mac OS, you switch environments at the command line.
See PEP 405and the official Python Tutorial on Virtual Environments and Packagesfor more information about Python virtual environments.
Supporting Multiple Operating Systems¶
If you need to distribute your application for more than one OS,for example both Windows and Mac OS X, you must install PyInstalleron each platform and bundle your app separately on each.
You can do this from a single machine using virtualization.The free virtualBox or the paid VMWare and Parallelsallow you to run another complete operating system as a “guest”.You set up a virtual machine for each “guest” OS.In it you installPython, the support packages your application needs, and PyInstaller.
![]()
A File Sync & Share system like NextCloud is useful with virtual machines.Install the synchronization client in each virtual machine,all linked to your synchronization account.Keep a single copy of your script(s) in a synchronized folder.Then on any virtual machine you can run PyInstaller thus:
PyInstaller reads scripts from the common synchronized folder,but writes its work files and the bundled app in folders thatare local to the virtual machine.
If you share the same home directory on multiple platforms, forexample GNU/Linux and OS X, you will need to set the PYINSTALLER_CONFIG_DIRenvironment variable to different values on each platform otherwisePyInstaller may cache files for one platform and use them on the otherplatform, as by default it uses a subdirectory of your home directoryas its cache location.
It is said to be possible to cross-develop for Windows under GNU/Linuxusing the free Wine environment.Further details are needed, see How to Contribute.
Capturing Windows Version Data¶
A Windows app may require a Version resource file.A Version resource contains a group of data structures,some containing binary integers and some containing strings,that describe the properties of the executable.For details see the Microsoft Version Information Structures page.
Version resources are complex andsome elements are optional, others required.When you view the version tab of a Properties dialog,there’s no simple relationship betweenthe data displayed and the structure of the resource.For this reason PyInstaller includes the
pyi-grab_version command.It is invoked with the full path name of any Windows executablethat has a Version resource:
The command writes text that representsa Version resource in readable form to standard output.You can copy it from the console window or redirect it to a file.Then you can edit the version information to adapt it to your program.Using
pyi-grab_version you can find an executable that displays the kind ofinformation you want, copy its resource data, and modify it to suit your package.
The version text file is encoded UTF-8 and may contain non-ASCII characters.(Unicode characters are allowed in Version resource string fields.)Be sure to edit and save the text file in UTF-8 unless you arecertain it contains only ASCII string values.
Your edited version text file can be given with the
--version-file= option to pyinstaller or pyi-makespec .The text data is converted to a Version resource andinstalled in the bundled app.
In a Version resource there are two 64-bit binary values,
FileVersion and ProductVersion .In the version text file these are given as four-element tuples,for example:
The elements of each tuple represent 16-bit valuesfrom most-significant to least-significant.For example the value
(2,0,4,0) resolves to0002000000040000 in hex.
You can also install a Version resource from a text file afterthe bundled app has been created, using the
pyi-set_version command:
pyi-set_version version_text_fileexecutable_file
The
pyi-set_version utility reads a version text file as writtenby pyi-grab_version , converts it to a Version resource,and installs that resource in the executable_file specified.
For advanced uses, examine a version text file as written by
pyi-grab_version .You find it is Python code that creates a VSVersionInfo object.The class definition for VSVersionInfo is found inutils/win32/versioninfo.py in the PyInstaller distribution folder.You can write a program that imports versioninfo .In that program you can eval the contents of a version info text file to produce aVSVersionInfo object.You can use the .toRaw() method of that object toproduce a Version resource in binary form.Or you can apply the unicode() function to the objectto reproduce the version text file.
Building Mac OS X App Bundles¶
Under Mac OS X, PyInstaller always builds a UNIX executable in
dist .If you specify --onedir , the output is a folder named myscript containing supporting files and an executable named myscript .If you specify --onefile , the output is a single UNIX executablenamed myscript .Either executable can be started from a Terminal command line.Standard input and output work as normal through that Terminal window.
If you specify
--windowed with either option, the dist folderalso contains an OS X application named myscript.app .
As you probably know, an application is a special type of folder.The one built by PyInstaller contains a folder always named
Contents which contains:
Use the
icon= argument to specify a custom icon for the application.It will be copied into the Resources folder.(If you do not specify an icon file, PyInstaller supplies afile icon-windowed.icns with the PyInstaller logo.)
Use the
osx-bundle-identifier= argument to add a bundle identifier.This becomes the CFBundleIdentifier used in code-signing(see the PyInstaller code signing recipeand for more detail, the Apple code signing overview technical note).
You can add other items to the
Info.plist by editing the spec file;see Spec File Options for a Mac OS X Bundle below.
Platform-specific Notes¶GNU/Linux¶Making GNU/Linux Apps Forward-Compatible¶
Under GNU/Linux, PyInstaller does not bundle
libc (the C standard library, usually glibc , the Gnu version) with the app.Instead, the app expects to link dynamically to the libc from thelocal OS where it runs.The interface between any app and libc is forward compatible tonewer releases, but it is not backward compatible to older releases.
For this reason, if you bundle your app on the current version of GNU/Linux,it may fail to execute (typically with a runtime dynamic link error) ifit is executed on an older version of GNU/Linux.
The solution is to always build your app on the oldest version ofGNU/Linux you mean to support.It should continue to work with the
libc found on newer versions.
The GNU/Linux standard libraries such as
glibc are distributed in 64-bitand 32-bit versions, and these are not compatible.As a result you cannot bundle your app on a 32-bit system and run iton a 64-bit installation, nor vice-versa.You must make a unique version of the app for each word-length supported.
Windows¶
For Python >= 3.5 targeting Windows < 10, the developer needs to takespecial care to include the Visual C++ run-time .dlls:Python 3.5 uses Visual Studio 2015 run-time, which has been renamed into“Universal CRT“and has become part of Windows 10.For Windows Vista through Windows 8.1 there are Windows Update packages,which may or may not be installed in the target-system.So you have the following options:
Mac OS X¶Making Mac OS X apps Forward-Compatible¶
In Mac OS X, components from one version of the OS are usually compatiblewith later versions, but they may not work with earlier versions.
The only way to be certain your app supports an older version of Mac OS Xis to run PyInstaller in the oldest version of the OS you need to support.
For example, to be sure of compatibility with “Snow Leopard” (10.6)and later versions, you should execute PyInstaller in that environment.You would create a copy of Mac OS X 10.6, typically in a virtual machine.In it, install the desired level of Python(the default Python in Snow Leopard was 2.6, which PyInstaller no longer supports),and install PyInstaller, your source, and all its dependencies.Then build your app in that environment.It should be compatible with later versions of Mac OS X.
Building 32-bit Apps in Mac OS X¶
Note
![]()
This section still refers to Python 2.7 provided by Apple.It might not be valid for Python 3 installedfrom MacPorts or Homebrew.
Please contribute to keep this section up-to-date.
Older versions of Mac OS X supported both 32-bit and 64-bit executables.PyInstaller builds an app using the the word-length of the Python used to execute it.That will typically be a 64-bit version of Python,resulting in a 64-bit executable.To create a 32-bit executable, run PyInstaller under a 32-bit Python.
Python as installed in OS X will usually be executable in either 64- or 32-bit mode.To verify this, apply the
file command to the Python executable:
The OS chooses which architecture to run, and typically defaults to 64-bit.You can force the use of either architecture by name using the
arch command:
Apple’s default
/usr/bin/python may circumvent the arch specification and run 64-bit regardless.(That is not the case if you apply arch to a specific versionsuch as /usr/bin/python2.7 .)To make sure of running 32-bit in all cases, set the following environment variable:
Getting the Opened Document Names¶
Note
Support for OpenDocument events is broken in PyInstaller 3.0owing to code changes needed in the bootloader to support currentversions of Mac OS X.Do not attempt to use this feature until it has been fixed.If this feature is important to you, follow and comment onthe status of PyInstaller Issue #1309.
When a user double-clicks a document of a type your applicationsupports, or when a user drags a document icon and drops iton your application’s icon, Mac OS X launches your applicationand provides the name(s) of the opened document(s) in theform of an OpenDocument AppleEvent.This AppleEvent is received by the bootloaderbefore your code has started executing.
The bootloader gets the names of opened documents fromthe OpenDocument event and encodes them into the
argv string before starting your code.Thus your code can query sys.argv to get the namesof documents that should be opened at startup.
OpenDocument is the only AppleEvent the bootloader handles.If you want to handle other events, or events thatare delivered after the program has launched, you mustset up the appropriate handlers.
AIX¶
Mac os security apps. Depending on whether Python was build as a 32-bit or a 64-bit executableyou may need to set or unsetthe environment variable
OBJECT_MODE .To determine the size the following command can be used:
When the answer is
True (as above) Python was build as a 32-bitexecutable.
When working with a 32-bit Python executable proceed as follows:
When working with a 64-bit Python executable proceed as follows:
Estimated reading time: 16 minutes
Welcome to Docker Desktop! The Docker Desktop for Mac user manual provides information on how to configure and manage your Docker Desktop settings.
For information about Docker Desktop download, system requirements, and installation instructions, see Install Docker Desktop.
Note
This page contains information about the Docker Desktop Stable release. For information about features available in Edge releases, see the Edge release notes.
Preferences
The Docker Preferences menu allows you to configure your Docker settings such as installation, updates, version channels, Docker Hub login,and more.
Choose the Docker menu > Preferences from themenu bar and configure the runtime options described below.
General
On the General tab, you can configure when to start and update Docker:
Reset Default App Run
Resources
The Resources tab allows you to configure CPU, memory, disk, proxies, network, and other resources.
Advanced
On the Advanced tab, you can limit resources available to Docker.
How To Run App As Administrator On Mac
Advanced settings are:
CPUs: By default, Docker Desktop is set to use half the number of processorsavailable on the host machine. To increase processing power, set this to ahigher number; to decrease, lower the number.
Memory: By default, Docker Desktop is set to use
2 GB runtime memory,allocated from the total available memory on your Mac. To increase the RAM, set this to a higher number. To decrease it, lower the number.
Swap: Configure swap file size as needed. The default is 1 GB.
Disk image size: Specify the size of the disk image.
Disk image location: Specify the location of the Linux volume where containers and images are stored.
You can also move the disk image to a different location. If you attempt to move a disk image to a location that already has one, you get a prompt asking if you want to use the existing image or replace it.
File sharingMac Run App As Admin
Use File sharing to allow local directories on the Mac to be shared with Linux containers.This is especially useful forediting source code in an IDE on the host while running and testing the code in a container.By default the
/Users , /Volume , /private , /tmp and /var/folders directory are shared. If your project is outside this directory then it must be addedto the list. Otherwise you may get Mounts denied or cannot start service errors at runtime.
File share settings are:
Tips on shared folders, permissions, and volume mounts
Proxies
Docker Desktop detects HTTP/HTTPS Proxy Settings from macOS and automaticallypropagates these to Docker. For example, if you set yourproxy settings to
http://proxy.example.com , Docker uses this proxy whenpulling containers.
Your proxy settings, however, will not be propagated into the containers you start.If you wish to set the proxy settings for your containers, you need to defineenvironment variables for them, just like you would do on Linux, for example:
For more information on setting environment variables for running containers,see Set environment variables.
Network
You can configure Docker Desktop networking to work on a virtual private network (VPN). Specify a network address translation (NAT) prefix and subnet mask to enable Internet connectivity.
Docker Engine
The Docker Engine page allows you to configure the Docker daemon to determine how your containers run.
Type a JSON configuration file in the box to configure the daemon settings. For a full list of options, see the Docker Enginedockerd commandline reference.
Click Apply & Restart to save your settings and restart Docker Desktop.
Command Line
On the Command Line page, you can specify whether or not to enable experimental features.
Experimental features provide early access to future product functionality.These features are intended for testing and feedback only as they may changebetween releases without warning or can be removed entirely from a futurerelease. Experimental features must not be used in production environments.Docker does not offer support for experimental features.
To enable experimental features in the Docker CLI, edit the
config.json file and set experimental to enabled.
To enable experimental features from the Docker Desktop menu, clickSettings (Preferences on macOS) > Command Line and then turn onthe Enable experimental features toggle. Click Apply & Restart.
For a list of current experimental features in the Docker CLI, see Docker CLI Experimental features.
On both Docker Desktop Edge and Stable releases, you can toggle the experimental features on and off. If you toggle the experimental features off, Docker Desktop uses the current generally available release of Docker Engine.
You can see whether you are running experimental mode at the command line. If
Experimental is true , then Docker is running in experimental mode, as shownhere. (If false , Experimental mode is off.)
Kubernetes
Docker Desktop includes a standalone Kubernetes server that runs on your Mac, sothat you can test deploying your Docker workloads on Kubernetes.
The Kubernetes client command,
kubectl , is included and configured to connectto the local Kubernetes server. If you have kubectl already installed andpointing to some other environment, such as minikube or a GKE cluster, be sureto change context so that kubectl is pointing to docker-desktop :
If you installed
kubectl with Homebrew, or by some other method, andexperience conflicts, remove /usr/local/bin/kubectl .
Reset
Reset and Restart options
On Docker Desktop Mac, the Restart Docker Desktop, Reset to factory defaults, and other reset options are available from the Troubleshoot menu.
For information about the reset options, see Logs and Troubleshooting.
Dashboard
The Docker Desktop Dashboard enables you to interact with containers and applications and manage the lifecycle of your applications directly from your machine. The Dashboard UI shows all running, stopped, and started containers with their state. It provides an intuitive interface to perform common actions to inspect and manage containers and existing Docker Compose applications. For more information, see Docker Desktop Dashboard.
Add TLS certificates
You can add trusted Certificate Authorities (CAs) (used to verify registryserver certificates) and client certificates (used to authenticate toregistries) to your Docker daemon.
Add custom CA certificates (server side)
All trusted CAs (root or intermediate) are supported. Docker Desktop creates acertificate bundle of all user-trusted CAs based on the Mac Keychain, andappends it to Moby trusted certificates. So if an enterprise SSL certificate istrusted by the user on the host, it is trusted by Docker Desktop.
To manually add a custom, self-signed certificate, start by adding thecertificate to the macOS keychain, which is picked up by Docker Desktop. Here isan example:
Or, if you prefer to add the certificate to your own local keychain only (ratherthan for all users), run this command instead:
See also, Directory structures forcertificates.
Note: You need to restart Docker Desktop after making any changes to thekeychain or to the
~/.docker/certs.d directory in order for the changes totake effect.
For a complete explanation of how to do this, see the blog post AddingSelf-signed Registry Certs to Docker & Docker Desktop forMac.
Add client certificates
You can put your client certificates in
~/.docker/certs.d/<MyRegistry>:<Port>/client.cert and~/.docker/certs.d/<MyRegistry>:<Port>/client.key .
When the Docker Desktop application starts, it copies the
~/.docker/certs.d folder on your Mac to the /etc/docker/certs.d directory on Moby (the DockerDesktop xhyve virtual machine).
Directory structures for certificates
If you have this directory structure, you do not need to manually add the CAcertificate to your Mac OS system login:
The following further illustrates and explains a configuration with customcertificates:
You can also have this directory structure, as long as the CA certificate isalso in your keychain.
To learn more about how to install a CA root certificate for the registry andhow to set the client TLS certificate for verification, seeVerify repository client with certificatesin the Docker Engine topics.
Install shell completion
Docker Desktop comes with scripts to enable completion for the
docker and docker-compose commands. The completion scripts may befound inside Docker.app , in the Contents/Resources/etc/ directory and can beinstalled both in Bash and Zsh.
Bash
Bash has built-in support forcompletion To activate completion for Docker commands, these files need to becopied or symlinked to your
bash_completion.d/ directory. For example, if youinstalled bash via Homebrew:
Add the following to your
~/.bash_profile :
OR
Zsh
In Zsh, the completionsystemtakes care of things. To activate completion for Docker commands,these files need to be copied or symlinked to your Zsh
site-functions/ directory. For example, if you installed Zsh via Homebrew:
Fish-Shell
Fish-shell also supports tab completion completionsystem. To activate completion for Docker commands,these files need to be copied or symlinked to your Fish-shell
completions/ directory.
Create the
completions directory:
Now add fish completions from docker.
Mac Run App As AdminGive feedback and get help
To get help from the community, review current user topics, join or start adiscussion, log on to our Docker Desktop for Macforum.
Run Default Apps
To report bugs or problems, log on to Docker Desktop for Mac issues onGitHub,where you can review community reported issues, and file new ones. SeeLogs and Troubleshooting for more details.
For information about providing feedback on the documentation or update it yourself, see Contribute to documentation.
Docker HubMac Default Mail App
Select Sign in /Create Docker ID from the Docker Desktop menu to access your Docker Hub account. Once logged in, you can access your Docker Hub repositories and organizations directly from the Docker Desktop menu.
For more information, refer to the following Docker Hub topics:
Two-factor authentication
Docker Desktop enables you to sign into Docker Hub using two-factor authentication. Two-factor authentication provides an extra layer of security when accessing your Docker Hub account.
You must enable two-factor authentication in Docker Hub before signing into your Docker Hub account through Docker Desktop. For instructions, see Enable two-factor authentication for Docker Hub.
After you have enabled two-factor authentication:
After you have successfully authenticated, you can access your organizations and repositories directly from the Docker Desktop menu.
Where to go next
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |