MacOS installation TensorFlow2.1.0

surroundings:

Mac  10.15.3 (19D76)

Python 3.6.8:https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.9.pkg

TensorFlow: 2.1.0

 

1. Download Python installation package installed, and the installation opened pkg.

wget -i -c https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.9.pkg

 

2. Go to the installation directory. Set source software, upgrades pip

cd /Library/Frameworks/Python.framework/Versions/3.6/bin
./pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
./pip3 install pip -U

 

3. Upgrade setuptools tool, because some packages need to install the latest version tensorflow

./pip3 install --upgrade setuptools

 

4. Query TensorFlow version can be installed

cd /Library/Frameworks/Python.framework/Versions/3.6/bin
./pip3 search tensorflow
➜  / pip3 search tensorflow
tensorflow (2.1.0)                                - TensorFlow is an open source machine learning framework for everyone.
tensorflow-qndex (0.0.22)                         - tensorflow-qnd x tensorflow-extenteten
tensorflow-plot (0.3.2)                           - TensorFlow Plot

 

5. Installation specified tensorflow2.1.0

./pip3 install tensorflow==2.1.0

During the version might be version-dependent or too low, resulting in not installed, follow the prompts to install the dependent libraries. As ./pip3 install h5py 

 

6. Verify that the installation was successful

➜  bin ./python3
Python 3.6.8 (v3.6.8:3c6b436a57, Dec 24 2018, 02:04:31)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print sess.run(hello)
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print sess.run(a+b)
42
>>>

 

Guess you like

Origin www.cnblogs.com/phpdragon/p/12366301.html