Doug Hellmann committed 43bfa2d

Use distutils to get the site-packages directory. Fixes #112

  • Participants
  • Parent commits bd46fdc

Comments (0)

Files changed (3)

File docs/en/history.rst

     fix for :bbissue:`134`)
   - Extend :ref:`command-rmvirtualenv` to allow removing more than one
     environment at a time. (contributed by :bbuser:`ciberglo`)
+  - Change the definition of
+    ``virtualenvwrapper_get_site_packages_dir`` to ask ``distutils``
+    for the ``site-packages`` directory instead of trying to build the
+    path ourselves in the shell script. This should resolve
+    :bbissue:`112` and improve support for Python interpreters other
+    than C Python. Thanks to Carl Meyer and Dario Bertini for their
+    contributions toward the fix.

File tests/

 test_dir=$(cd $(dirname $0) && pwd)
 source "$test_dir/"
 setUp () {
     rm -rf "$WORKON_HOME"
     mkdir -p "$WORKON_HOME"


 # Prints the path to the site-packages directory for the current environment.
 function virtualenvwrapper_get_site_packages_dir {
-    echo "$VIRTUAL_ENV/lib/python`virtualenvwrapper_get_python_version`/site-packages"
+    "$VIRTUAL_ENV/bin/python" -c "import distutils; print(distutils.sysconfig.get_python_lib())"
 # Path management for packages outside of the virtual env.