如何使用CUDA 10.0安装tensorflow-gpu 1.12

时间:2018-12-03 10:10:40

标签: tensorflow deep-learning open-source

我知道tensorflow-gpu == 1.12需要CUDA 9.0或更低版本,但是是否有可能在CUDA 10.0上安装Tensorflow?可能是通过源代码还是使用Bazel?

更新:我尝试从Github下载并通过Bazel安装,但出现以下错误。

Python 3.7.1 (default, Oct 23 2018, 19:19:42) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "/some-folder/tensorflow-1.12.0/tensorflow/python/platform/self_check.py", line 25, in <module>
    from tensorflow.python.platform import build_info
ImportError: cannot import name 'build_info' from 'tensorflow.python.platform' (unknown location)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/some-folder/tensorflow-1.12.0/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/some-folder/tensorflow-1.12.0/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/some-folder/tensorflow-1.12.0/tensorflow/python/pywrap_tensorflow.py", line 25, in <module>
    from tensorflow.python.platform import self_check
  File "/some-folder/tensorflow-1.12.0/tensorflow/python/platform/self_check.py", line 27, in <module>
    raise ImportError("Could not import tensorflow. Do not import tensorflow "
ImportError: Could not import tensorflow. Do not import tensorflow from its source directory; change directory to outside the TensorFlow source tree, and relaunch your Python interpreter from there.

2 个答案:

答案 0 :(得分:0)

tensorflow不支持python 3.7版本。 需要Python 3.4、3.5或3.6

请参阅下文 https://www.tensorflow.org/install/pip

答案 1 :(得分:0)

我们只需要走出Source Directory并运行python文件即可。如果您正在使用php artisan cache:clear php artisan route:cache php artisan config:clear php artisan view:clear composer update composer dump-autoload create fresh installation copy fresh one into old version and dont overwrite changed cache from file to database confirmed `/public/index.php` is correct SESSION_LIFETIME = 120 SESSION_DOMAIN set to domain generated new app key checked file permissions 命令运行文件,则需要将文件移到源目录之外。

当您从源目录使用python filename.py时,它将导入文件夹import tensorflow而不是实际的tensorflow库