Nikhil Benesch <[email protected]> added the comment:
This issue continues to exist with the system Python on macOS. Here is how to
reproduce on macOS Catalina 10.15.7 and Xcode 12.1.
$ /usr/bin/python3 --version
Python 3.8.2
$ /usr/bin/python3 -c 'import venv; venv.create("venv");'
$ venv/bin/python3
dyld: Library not loaded: @executable_path/../Python3
Referenced from: /Users/benesch/venv/bin/python3
Reason: image not found
Abort trap: 6
Weird, isn't it? The thing that gets copied into the venv is just a totally
different file than /usr/bin/python3:
$ ls -lah venv/bin/python3
-rwxr-xr-x 1 benesch staff 148K Oct 26 23:16 venv/bin/python3
$ ls -lah /usr/bin/python3
-rwxr-xr-x 1 root wheel 31K Sep 21 20:29 /usr/bin/python3
I assume this is Apple's bug, but I'll be damned if I have to file another
report into the blackhole that is radar. If someone needs a quick workaround,
just create your venvs with symlinks, which works just fine:
$ /usr/bin/python3 -c 'import venv; venv.create("venv2");'
$ venv2/bin/python3
Python 3.8.2 (default, Sep 24 2020, 19:37:08)
[Clang 12.0.0 (clang-1200.0.32.21)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
Incidentally this is why `/usr/bin/python3 -m venv` works just fine, since it
defaults to `symlinks=True` on macOS.
----------
nosy: +benesch
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38705>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com