Getting started with artificial intelligence, TensorFlow environment installation guide

Pictures from the Internet

artificial intelligence [1] At present, the hottest technology has profoundly changed human social life and the world. City Lions can't fall behind the times, TensorFlow [2] It is an artificial intelligence development framework developed by Google for machine learning and deep neural network. Here's how to use Android TensorFlow framework.

hardware environment

  • Operating system: Ubuntu 17.04 x64 [3]
  • CPU: Intel(R) Core(TM) i3-4130 CPU @ 3.40GHz
  • python: Python 2.7.13[4] , native to Ubuntu

setup script

  1. Download installation files tensorflow-0.8.0-cp27-none-linux_x86_64.whl
    Save the file to the path ~ / tensorflow / tensorflow-0.8.0-cp27-none-linux-x86-64.wh

  2. Preparing the virtuareenv environment [5]

# 1. Install Python virtualenv
$ sudo apt-get install python-pip python-dev python-virtualenv

#  2. Create virtualenv environment
$ virtualenv --system-site-packages ~/tensorflow
$ cd ~/tensorflow

# 3. Perform installation
pip install --upgrade ./tensorflow-0.8.0-cp27-none-linux_x86_64.whl
  1. If all goes well, you'll see a process like this
pip install --upgrade ./tensorflow-0.8.0-cp27-none-linux_x86_64.whl --trusted-host mirrors.aliyun.com
Processing ./tensorflow-0.8.0-cp27-none-linux_x86_64.whl
Collecting protobuf==3.0.0b2 (from tensorflow==0.8.0)
  Downloading http://mirrors.aliyun.com/pypi/packages/00/8e/9a3feb39d464eb7aacc108e6e6e1f2368ec741821486964c4cd0f41baabb/protobuf-3.0.0b2-py2.py3-none-any.whl (326kB)
    100% |████████████████████████████████| 327kB 1.9MB/s 
Collecting wheel (from tensorflow==0.8.0)
  Downloading http://mirrors.aliyun.com/pypi/packages/0c/80/16a85b47702a1f47a63c104c91abdd0a6704ee8ae3b4ce4afc49bc39f9d9/wheel-0.30.0-py2.py3-none-any.whl (49kB)
    100% |████████████████████████████████| 51kB 624kB/s 
Requirement already up-to-date: numpy>=1.8.2 in /home/ethink/.local/lib/python2.7/site-packages (from tensorflow==0.8.0)
Requirement already up-to-date: six>=1.10.0 in /home/ethink/.local/lib/python2.7/site-packages (from tensorflow==0.8.0)
Collecting setuptools (from protobuf==3.0.0b2->tensorflow==0.8.0)
  Downloading http://mirrors.aliyun.com/pypi/packages/bb/e0/ea620f9ecbaaaf3ebb288cdbbe8cc20b6a789c17e42d8916662b218e3349/setuptools-38.2.4-py2.py3-none-any.whl (489kB)
    100% |████████████████████████████████| 491kB 1.6MB/s 
Installing collected packages: setuptools, protobuf, wheel, tensorflow
  Found existing installation: setuptools 32.3.1
    Uninstalling setuptools-32.3.1:
      Successfully uninstalled setuptools-32.3.1
  Found existing installation: wheel 0.29.0
    Uninstalling wheel-0.29.0:
      Successfully uninstalled wheel-0.29.0
Successfully installed protobuf-3.0.0b2 setuptools-38.2.4 tensorflow-0.8.0 wheel-0.30.0

OK, see the final success indicates success. Let's test it. The author encountered the error of "Could not find a version" during the actual installation. Please click to check resolvent.

Write a code test

$ python

>>> 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
>>>

Could not find a version {ා myerror} encountered during installation

Problem Description:

Processing ./tensorflow-0.8.0-cp27-none-linux_x86_64.whl
Collecting protobuf==3.0.0b2 (from tensorflow==0.8.0)
  The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host mirrors.aliyun.com'.
  Could not find a version that satisfies the requirement protobuf==3.0.0b2 (from tensorflow==0.8.0) (from versions: )
No matching distribution found for protobuf==3.0.0b2 (from tensorflow==0.8.0)

resolvent:
Add the option. Here, the trusted host mirrors.aliyun.com image is used

pip install --upgrade ./tensorflow-0.8.0-cp27-none-linux_x86_64.whl --trusted-host mirrors.aliyun.com
  1. China's first scientific and technological media that pays systematic attention to artificial intelligence Heart of machine

  2. TensorFlow Chinese community http://www.tensorfly.cn/

  3. Ubuntu domestic Download Image

  4. Python is an object-oriented interpreted programming language

  5. virtualenv a technology for managing different versions of Python environment Click to view

Tags: Python pip Ubuntu Google

Posted on Sun, 03 May 2020 07:12:23 -0700 by F.Danials