2016-10-14 12 views
9

Tôi đã thử pip install tensorflow trên OS X El Capitan và nó đã thành công. Tuy nhiên, nếu tôi cố gắng nhập khẩu lưu lượng, ImportError đã xảy ra. Hãy cho tôi biết khi nào bạn biết.Yêu cầu tensorflow với Python 2.7.11 xảy ra ImportError

>>> import tensorflow 
Traceback (most recent call last): 
File "<stdin>", line 1, in <module> 
File "/usr/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in <module> 
from tensorflow.python import * 
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module> 
from tensorflow.python import pywrap_tensorflow 
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module> 
_pywrap_tensorflow = swig_import_helper() 
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper 
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description) 
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): no suitable image found. Did find: 
/usr/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 
>>> 

Trả lời

10

Tôi có cùng một câu hỏi. Cố gắng tuân theo [hướng dẫn chính thức] để cài đặt tensorflow: https://www.tensorflow.org/versions/r0.11/get_started/os_setup.html#pip-installation

# Mac OS X 
$ sudo easy_install pip 
$ sudo easy_install --upgrade six 

Sau đó, chọn nhị phân đúng để cài đặt:

# Ubuntu/Linux 64-bit, CPU only, Python 2.7 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0rc0-cp27-none-linux_x86_64.whl 

# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7 
# Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below. 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0rc0-cp27-none-linux_x86_64.whl 

# Mac OS X, CPU only, Python 2.7: 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.11.0rc0-py2-none-any.whl 

# Mac OS X, GPU enabled, Python 2.7: 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow-0.11.0rc0-py2-none-any.whl 

# Ubuntu/Linux 64-bit, CPU only, Python 3.4 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0rc0-cp34-cp34m-linux_x86_64.whl 

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4 
# Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below. 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0rc0-cp34-cp34m-linux_x86_64.whl 

# Ubuntu/Linux 64-bit, CPU only, Python 3.5 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0rc0-cp35-cp35m-linux_x86_64.whl 

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.5 
# Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below. 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0rc0-cp35-cp35m-linux_x86_64.whl 

# Mac OS X, CPU only, Python 3.4 or 3.5: 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.11.0rc0-py3-none-any.whl 

# Mac OS X, GPU enabled, Python 3.4 or 3.5: 
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow-0.11.0rc0-py3-none-any.whl 

Install TensorFlow:

# Python 2 
$ sudo pip install --upgrade $TF_BINARY_URL 

# Python 3 
$ sudo pip3 install --upgrade $TF_BINARY_URL 
+0

Cảm ơn bạn soooo nhiều ! Nó hoạt động! –

+0

yep, hoạt động. kinh ngạc. sẽ lãng phí một tuần để sửa lỗi này. – Wapiti

Các vấn đề liên quan