Doug Hellmann committed 06f4dd3

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

Comments (0)

Files changed (3)


     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.
 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.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.