10/22/2023 0 Comments Python install package![]() This solution is primary based on modules importlib and pkgutil and work with CPython 3.4 and CPython 3.5, but has no support for the CPython 2. ![]() I could not find any reference to this issue in the documentation. ![]() If we run the aforementioned solution from /tmp/behave > import pipīehave=1.2.5a1 is missing from the second example, because the working directory contains behave's setup.py file. If we run the aforementioned solution from /tmp > import pip Installed /private/tmp/test_env/lib/python2.7/site-packages/enum34-1.0-py2.7.eggįinished processing dependencies for behave=1.2.5a1 (test_env) $ cd /tmp/behave & pip install. Install the python package from the git repo We have behave's setup.py in /tmp/behave: (test_env) $ ls /tmp/behave/setup.py Remote: Total 4350 (delta 0), reused 0 (delta 0) Remote: Reusing existing pack: 4350, done. New python executable in test_env/bin/pythonĬlone a git repo with setup.py (test_env) $ git clone I have noticed a strange behaviour of this technique - when the Python interpreter is invoked in the same directory as a setup.py file, it does not list the package installed by setup.py. I added the result of this call to my flask server, so when I call it with I get the list of packages installed on the server's virtualenv. ![]() This solution applies to the system scope or to a virtual environment scope, and covers packages installed by setuptools, pip and ( god forbid) easy_install. Installed_packages_list = sorted(["%s=%s" % (i.key, i.version)Īs a (too long) one liner: sorted() ![]() Installed_packages = pip.get_installed_distributions() My 50 cents for getting a pip freeze-like list from a Python script: import pip ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |