Created
July 25, 2018 19:55
-
-
Save kwlzn/01694a2e8a1f4083045ba0967092a91d to your computer and use it in GitHub Desktop.
external pex bootstrapping example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[omerta ~]$ python2.7 | |
Python 2.7.13 (default, Mar 2 2017, 16:22:01) | |
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import requests | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
ImportError: No module named requests | |
>>> | |
[omerta ~]$ pex requests -o requests.pex | |
[omerta ~]$ python2.7 | |
Python 2.7.13 (default, Mar 2 2017, 16:22:01) | |
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import os, sys | |
>>> pex_filename = 'requests.pex' | |
>>> sys.path.insert(0, os.path.join(os.path.abspath(pex_filename), '.bootstrap')) | |
>>> from _pex import pex_bootstrapper | |
>>> pex_bootstrapper.bootstrap_pex_env(pex_filename) | |
>>> import requests | |
>>> requests.__file__ | |
'/Users/kwilson/.pex/install/requests-2.19.1-py2.py3-none-any.whl.9c19d1f49965483c8e82326b964ec1050dff6851/requests-2.19.1-py2.py3-none-any.whl/requests/__init__.pyc' | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment