Python Frequently Asked Questions, Release 3.9.5 Chapter 6. Python on Windows FAQ 68 Note that the search path for foo.pyd is PYTHONPATH, not the same as the path that Windows uses to search for foo.dll. Also, foo.pyd need not be present to run your program, whereas if you linked your program with a dll, the dll is required. Of course, foo.pyd is required if you want to say$_{import foo}$. In a DLL, linkage is declared in the source code with$_{__declspec(dllexport)}$ . In a .pyd, linkage is defined in a list of available functions. Yes, .pyd files are dll’s, but there are a few differences. If you have a DLL named$_{foo.pyd}$ , then it must have a function$_{PyInit_foo()}$ . You can then write Python “import foo”, and Python will search for foo.pyd (as well as foo.py, foo.pyc) and if it finds it, will attempt to call$_{PyInit_foo()}$ to initialize it. You do not link your .exe with foo.lib, as that would cause Windows to require the DLL to be present. See How can I create a stand-alone binary from a Python script? for a list of tools that can be used to make executables. The problem may be caused by a misconfiguration of virus checking software on the problem machine. Some virus scanners have been known to introduce startup overhead of two orders of magnitude when the scanner is configured to monitor all reads from the filesystem. Try checking the configuration of virus scanning software on your systems to ensure that they are indeed configured identically. McAfee, when configured to scan all file system read activity, is a particular offender. Usually Python starts very quickly on Windows, but occasionally there are bug reports that Python suddenly begins to take a long time to start up. This is made even more puzzling because Python will work fine on other Windows systems which appear to be configured identically. On Windows, the standard Python installer already associates the .py extension with a file type (Python.File) and gives that file type an open command that runs the interpreter ( D:\Program Files\Python\python.exe "%1" %* ). This is enough to make scripts executable from the command prompt as ‘foo.py’. If you’d rather be able to execute the script by simple typing ‘foo’ with no extension you need to add .py to the PATHEXT environment variable. C:\Users\YourName> py Desktop\hello.py hello So now you’ll ask the py command to give your script to Python by typing py followed by your script path: C:\Users\YourName> Now that we know the$_{py}$command is recognized, you can give your Python script to it. You’ll have to give either an absolute or a relative path to the Python script. Let’s say your Python script is located in your desktop and is named hello.py , and your command prompt is nicely opened in your home directory so you’re seeing something similar to: You may also find that you have a Start-menu entry such as Start ‣ Programs ‣ Python 3.x ‣ Python (command line) that results in you seeing the >>> prompt in a new window. If so, the window will disappear after you call the exit() function or enter the$_{Ctrl-Z}$character; Windows is running a single “python” command in the window, and closes it when you terminate the interpreter. 6.2 How do I make Python scripts executable? 6.3 Why does Python sometimes take so long to start? 6.4 How do I make an executable from a Python script? 6.5 Is a$_{*.pyd}$ file the same as a DLL?