Проблема с установкой TensorFlow для проекта Visual Studio Code C ++ в виртуальной машине Ubuntu 18.04.4 LTS - PullRequest
0 голосов
/ 13 июля 2020

Я работаю над завершающим проектом онлайн-курса Udacity C ++. У меня был выбор между добавлением функций в компьютерную игру-змейку или созданием собственного проекта. Я ищу работу в области искусственного интеллекта, поэтому я решил создать свой собственный проект и использовать TensorFlow для создания сверточной нейронной сети для классификатора изображений кошки и собаки в Visual Studio Code. У меня возникают ошибки во время установки TensorFlow, и я не знаю, как заставить работать #include path для TensorFlow op.h и shape_inference.h.

Вот ссылка на проект GitHub: https://github.com/ProfHariSeldon/CppND-Capstone-Hello-World

Я попытался установить TensorFlow на моей виртуальной машине Ubuntu 18.04.4 LTS, используя инструкции в https://www.tensorflow.org/install:

sudo apt install python-pip
pip install --upgrade pip
pip install tensorflow

Я не уверен, как использовать TensorFlow в C ++ (я прошел курс Udemy.com (https://www.udemy.com/course/machinelearning/), в котором использовался TensorFlow в Python, а не в C ++), потому что единственное упоминание о том, что это нужно сделать в Windows? Правильно?

TensorFlow протестирован и поддерживается в следующих 64-битных системах:

  • Python 3.5–3.8
  • Ubuntu 16.04 или новее
  • Windows 7 или новее (с распространяемым C ++)
  • macOS 10.12.6 (Sierra) или новее (без поддержки графического процессора)
  • Raspbian 9.0 или новее https://www.tensorflow.org/install

Кажется, две проблемы:

Первая

#includes, рекомендованные курсом Udacity C ++ по этой ссылке: https://www.tensorflow.org/guide/create_op

#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/shape_inference.h"

Фактическое расположение этих двух файлов в моей виртуальной машине Ubuntu 18.04.4 LTS

#include "./.local/lib/python2.7/site-packages/tensorflow_core/include/tensorflow/core/framework/op.h"
#include "./.local/lib/python2.7/site-packages/tensorflow_core/include/tensorflow/core/framework/shape_inference.h"

Ни один из вариантов #include не работает, оба говорят: «Невозможно открыть файл с исходным кодом. "в коде Visual Studio

Второй

Во время установки я получил следующие ошибки:

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: tensorboard 2.1.0 has requirement setuptools>=41.0.0, but you'll have setuptools 39.0.1 which is incompatible.
ERROR: google-auth 1.18.0 has requirement setuptools>=40.3.0, but you'll have setuptools 39.0.1 which is incompatible.
  WARNING: The scripts f2py, f2py2 and f2py2.7 are installed in '/home/tlroot/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts pyrsa-decrypt, pyrsa-encrypt, pyrsa-keygen, pyrsa-priv2pub, pyrsa-sign and pyrsa-verify are installed in '/home/tlroot/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script chardetect is installed in '/home/tlroot/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script google-oauthlib-tool is installed in '/home/tlroot/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script markdown_py is installed in '/home/tlroot/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script tensorboard is installed in '/home/tlroot/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts estimator_ckpt_converter, saved_model_cli, tensorboard, tf_upgrade_v2, tflite_convert, toco and toco_from_protos are installed in '/home/tlroot/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Полный текст установки выводится в README проекта GitHub (https://github.com/ProfHariSeldon/CppND-Capstone-Hello-World/blob/master/README.md), потому что форум не позволяет мне помещать его в этот пост, потому что он «выглядит как спам»

ОБНОВЛЕНИЕ

РЕДАКТИРОВАТЬ: Я обновился до Ubun tu 20.04 (как предлагается ниже), и это позволило избавиться от двух ОШИБОК, но ПРЕДУПРЕЖДЕНИЯ все еще присутствуют. Я все еще не могу заставить #include работать, есть ли что-то, чего мне не хватает с #include?

  WARNING: The scripts pyrsa-decrypt, pyrsa-encrypt, pyrsa-keygen, pyrsa-priv2pub, pyrsa-sign and pyrsa-verify are installed in '/home/tlroot/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script markdown_py is installed in '/home/tlroot/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script google-oauthlib-tool is installed in '/home/tlroot/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts f2py, f2py3 and f2py3.8 are installed in '/home/tlroot/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script tensorboard is installed in '/home/tlroot/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts estimator_ckpt_converter, saved_model_cli, tensorboard, tf_upgrade_v2, tflite_convert, toco and toco_from_protos are installed in '/home/tlroot/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Я заметил, что это руководство: https://medium.com/createdd-notes/install-tensorflow-with-virtuelenv-and-visual-studio-code-on-mac-6b9f93f0fb08 О том, как установить TensorFlow в коде Visual Studio говорится: «Настроить код Visual Studio Установить Visual Studio Python Расширение» https://marketplace.visualstudio.com/items?itemName=ms-python.python

Я попробую это завтра, но я не знаю, если это исправит это, потому что весь смысл этого проекта - сделать проект TensorFlow C ++, а не проект Python.

...