Skip to content

Commit 306d824

Browse files
committed
windows: remove Scripts/pip*.exe from distributions
These executables didn't work because of the way they are compiled references the absolute path of python.dll on the build machine. This is probably fixable. But for now we go the easy route of deleting the files. Closes #88.
1 parent 2fb57a5 commit 306d824

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

cpython-windows/build.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,6 +2154,21 @@ def build_cpython(
21542154
os.environ,
21552155
)
21562156

2157+
# The executables in the Scripts/ directory don't work because they reference
2158+
# python.dll in the wrong path. You can run these via e.g. `python.exe -m pip`.
2159+
# So just delete them for now.
2160+
for filename in sorted(os.listdir(install_dir / "Scripts")):
2161+
assert filename.startswith("pip") and filename.endswith(".exe")
2162+
p = install_dir / "Scripts" / filename
2163+
log("removing non-functional executable: %s" % p)
2164+
os.unlink(p)
2165+
2166+
# But this leaves the Scripts directory empty, which we don't want. So
2167+
# create a placeholder file to ensure the directory is created on archive
2168+
# extract.
2169+
with (install_dir / "Scripts" / ".empty").open("ab"):
2170+
pass
2171+
21572172
# Now copy the build artifacts into the output directory.
21582173
build_info = collect_python_build_artifacts(
21592174
pcbuild_path,

docs/quirks.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,20 @@ run time, the ``TCL_LIBRARY`` environment variable is set from within
143143
the process before the Python interpreter is initialized. This ensures the
144144
``.tcl`` files from the Python distribution are used.
145145

146+
.. _quirk_windows_no_pip:
147+
148+
No ``pip.exe`` on Windows
149+
=========================
150+
151+
The Windows distributions have ``pip`` installed however no ``Scripts/pip.exe``,
152+
``Scripts/pip3.exe``, and ``Scripts/pipX.Y.exe`` files are provided because
153+
the way these executables are built isn't portable. (It might be possible to
154+
change how these are built to make them portable.)
155+
156+
To use pip, run ``python.exe -m pip``. (It is generally a best practice to
157+
invoke pip via ``python -m pip`` on all platforms so you can be explicit
158+
about the ``python`` executable that pip uses.)
159+
146160
.. _quirk_macos_linking:
147161

148162
Linking Static Library on macOS

0 commit comments

Comments
 (0)