Skip to content

Commit

Permalink
clarify comment
Browse files Browse the repository at this point in the history
  • Loading branch information
pcmoritz committed Jul 3, 2018
1 parent 70f3bca commit 2ca3de9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions python/pyarrow/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,14 @@ def import_tensorflow_extension():
tensorflow_loaded = False

# Try to load the tensorflow extension directly
# (this is much faster than importing tensorflow)
# This is a performance optimization, tensorflow will always be
# loaded via the "import tensorflow" statement below if this
# doesn't succeed.
try:
site_paths = site.getsitepackages() + [site.getusersitepackages()]
except AttributeError:
# Workaround for https://github.com/pypa/virtualenv/issues/228
# Workaround for https://github.com/pypa/virtualenv/issues/228,
# this happends in some configurations of virtualenv
site_paths = [os.path.dirname(site.__file__) + '/site-packages']
for site_path in site_paths:
ext = os.path.join(site_path, "tensorflow",
Expand All @@ -191,7 +194,7 @@ def import_tensorflow_extension():
tensorflow_loaded = True
break

# If this failed, try to load tensorflow the normal ways
# If the above failed, try to load tensorflow the normal way
# (this is more expensive)
if not tensorflow_loaded:
try:
Expand Down

0 comments on commit 2ca3de9

Please sign in to comment.