2016-06-28 5 views
2

スクリプトをinstall tensorflowに設定したいと思いますが、インストールする方法は単純ではありません。pip installsetuptoolsを使用してテンソルフローをインストールする

私が知った唯一の方法は、この非常にハッキーな方法です。これを行うには、より良い、公式の方法がありますか? tensorflow 1.0以降

from setuptools import setup 
from setuptools.command.install import install 

from subprocess import call 
from sys import platform as _platform 

#linux or ios 
if _platform == "linux" or _platform == "linux2": 
    tensorfow_url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl" 
elif _platform == "darwin": 
    tensorfow_url = "https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0-py2-none-any.whl" 


class CustomInstallCommands(install): 
    """Installs tensorflow the hacky way""" 

    def run(self): 
     call(['pip', 'install', '--upgrade', tensorfow_url]) 
     install.run(self) 


setup(name='tensorflow_project', 
     version='0.1', 
     description='project with tensorflow', 
     packages=['tensorflow_project'], 
     install_requires=[ 
      'scipy', 
      'numpy', 
      'pandas', 
      'scikit-learn', 

     ], 
     zip_safe=False, 
     cmdclass={ 
      'install': CustomInstallCommands, 
      'develop': CustomInstallCommands, 
     }) 

答えて

0

、あなただけ

pip install tensorflow 
0

あなたはそれをインストールすることができます2つのTFモード、最初のあなたのGPUを利用しようとするCPUや他の上で動作する1がありますすることができます。

TensorFlow PythonパッケージのURLは更新を続け、インストールするにはInstalling TensorFlow on Ubuntu

で見つけることができ、最良のあなたのシステムに合ったTFパッケージに対応するURLを設定すると、この

#(Optional step: you may also want to consider installing it in a Virtual environment) 
virtualenv ~/tensorflow 
source ~/tensorflow/bin/activate 

に従ってください設定とバージョンが

export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0-cp27-none-linux_x86_64.whl 
#(this is the cpu version) 

または

必要があります
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0-cp27-none-linux_x86_64.whl 
#(this is the gpu version) 

はその後

pip install --upgrade $TF_BINARY_URL 

PS:あなたは仮想環境でそれをインストールした場合は、環境をアクティブにするために、上記の「ソース」コマンドでそれを有効にする必要があり

関連する問題