AI - tensorflow 編譯 (Ubuntu 16.04 LTS)

因為要使用的 PC 沒有 AVX、AVX2 所以要自己編譯

思路: 
    1. 安裝要的 python 版本
    2. 先下一次 pip3 install tensorflow 安裝需要的 lib,也看一下 tensorflw 使用的版本
    3. 下載相同的 tensorflow 並編譯


執行系統


CPUIntel(R) Atom(TM) CPU C3958 @ 2.00GHz (16核心)
Memory16G
作業系統:Ubuntu 16.04 LTS



安裝 openssl 1.1.X


wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1d.tar.gz
tar -zxvf OpenSSL_1_1_1d.tar.gz
cd openssl-OpenSSL_1_1_1d
./config
make
make install



安裝 python 3.16.4


wget http://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
tar -xvzf Python-3.6.4.tgz
cd Python-3.6.4
./configure
make
make install

wget https://bootstrap.pypa.io/pip/3.6/get-pip.py
python3 get-pip.py --force-reinstall



安裝 bazelisk


    wget https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-linux-amd64
    chmod +x bazelisk-linux-amd64
    mv bazelisk-linux-amd64 /usr/local/bin/bazel



編譯 tensorflow


git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
git checkout v2.6.2
./configure (都用預設)
gcc -march=native -Q --help=target | grep march (找等等march的參數)
/usr/local/bin/bazel build -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" --copt=-march=silvermont \
--copt=-msse3 --copt=-msse4.1 --copt=-msse4.2 --copt=-mpclmul --copt=-mpopcnt --copt=-maes \
--copt=-mno-avx --copt=-mno-avx2 //tensorflow/tools/pip_package:build_pip_package \
--local_ram_resources=2048 --verbose_failures


建立 whl 檔,並安裝

./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
pip3 install /tmp/tensorflow_pkg/tensorflow-2.6.2-cp36-cp36m-linux_x86_64.whl



編譯歷程

內建的 python 3.5.2 安裝 tensorflow

root@ubuntu1604:/home/# pip3 install tensorflow
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Collecting tensorflow
Downloading tensorflow-2.3.1-cp35-cp35m-manylinux2010_x86_64.whl (320.4 MB)
|████████████████████████████████| 320.4 MB 2.8 kB/s
Collecting tensorboard<3,>=2.3.0
Downloading tensorboard-2.5.0-py3-none-any.whl (6.0 MB)
|████████████████████████████████| 6.0 MB 12.7 MB/s
Collecting h5py<2.11.0,>=2.10.0
Downloading h5py-2.10.0-cp35-cp35m-manylinux1_x86_64.whl (2.8 MB)
|████████████████████████████████| 2.8 MB 12.9 MB/s
Collecting six>=1.12.0
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting google-pasta>=0.1.8
Downloading google_pasta-0.2.0-py3-none-any.whl (57 kB)
|████████████████████████████████| 57 kB 469 kB/s
Collecting protobuf>=3.9.2
Downloading protobuf-3.19.6-py2.py3-none-any.whl (162 kB)
|████████████████████████████████| 162 kB 12.8 MB/s
Requirement already satisfied: wheel>=0.26 in /usr/lib/python3/dist-packages (from tensorflow) (0.29.0)
Collecting opt-einsum>=2.3.2
Downloading opt_einsum-3.3.0-py3-none-any.whl (65 kB)
|████████████████████████████████| 65 kB 398 kB/s
Collecting astunparse==1.6.3
Downloading astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Collecting grpcio>=1.8.6
Downloading grpcio-1.41.1.tar.gz (21.2 MB)
|████████████████████████████████| 21.2 MB 80 kB/s
Collecting tensorflow-estimator<2.4.0,>=2.3.0
Downloading tensorflow_estimator-2.3.0-py2.py3-none-any.whl (459 kB)
|████████████████████████████████| 459 kB 13.2 MB/s
Requirement already satisfied: keras-preprocessing<1.2,>=1.1.1 in /usr/local/lib/python3.5/dist-packages (from tensorflow) (1.1.2)
Collecting gast==0.3.3
Downloading gast-0.3.3-py2.py3-none-any.whl (9.7 kB)
Requirement already satisfied: numpy<1.19.0,>=1.16.0 in /usr/local/lib/python3.5/dist-packages (from tensorflow) (1.18.5)
Collecting termcolor>=1.1.0
Downloading termcolor-1.1.0.tar.gz (3.9 kB)
Collecting wrapt>=1.11.1
Downloading wrapt-1.15.0-cp35-cp35m-manylinux2010_x86_64.whl (79 kB)
|████████████████████████████████| 79 kB 627 kB/s
Collecting absl-py>=0.7.0
Downloading absl_py-0.15.0-py3-none-any.whl (132 kB)
|████████████████████████████████| 132 kB 12.7 MB/s
Ignoring futures: markers 'python_version < "3.2"' don't match your environment
Ignoring enum34: markers 'python_version < "3.4"' don't match your environment
Collecting setuptools>=41.0.0
Downloading setuptools-50.3.2-py3-none-any.whl (785 kB)
|████████████████████████████████| 785 kB 13.1 MB/s
Collecting google-auth<2,>=1.6.3
Downloading google_auth-1.23.0-py2.py3-none-any.whl (114 kB)
|████████████████████████████████| 114 kB 12.5 MB/s
Collecting requests<3,>=2.21.0
Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB)
|████████████████████████████████| 61 kB 704 kB/s
Collecting markdown>=2.6.8
Downloading Markdown-3.2.2-py3-none-any.whl (88 kB)
|████████████████████████████████| 88 kB 710 kB/s
Collecting tensorboard-plugin-wit>=1.6.0
Downloading tensorboard_plugin_wit-1.8.1-py3-none-any.whl (781 kB)
|████████████████████████████████| 781 kB 11.9 MB/s
Collecting google-auth-oauthlib<0.5,>=0.4.1
Downloading google_auth_oauthlib-0.4.1-py2.py3-none-any.whl (18 kB)
Collecting werkzeug>=0.11.15
Downloading Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
|████████████████████████████████| 298 kB 12.4 MB/s
Collecting tensorboard<3,>=2.3.0
Downloading tensorboard-2.4.1-py3-none-any.whl (10.6 MB)
|████████████████████████████████| 10.6 MB 269 kB/s
Collecting rsa<5,>=3.1.4
Downloading rsa-4.7.2-py3-none-any.whl (34 kB)
Collecting cachetools<5.0,>=2.0.0
Downloading cachetools-4.2.4-py3-none-any.whl (10 kB)
Collecting pyasn1-modules>=0.2.1
Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
|████████████████████████████████| 155 kB 13.2 MB/s
Collecting requests-oauthlib>=0.7.0
Downloading requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)
Collecting importlib-metadata
Downloading importlib_metadata-2.1.3-py2.py3-none-any.whl (10 kB)
Collecting pyasn1<0.5.0,>=0.4.6
Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
|████████████████████████████████| 77 kB 549 kB/s
Collecting certifi>=2017.4.17
Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
|████████████████████████████████| 149 kB 12.6 MB/s
Collecting chardet<5,>=3.0.2
Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
|████████████████████████████████| 178 kB 12.0 MB/s
Collecting urllib3<1.27,>=1.21.1
Downloading urllib3-1.26.9-py2.py3-none-any.whl (138 kB)
|████████████████████████████████| 138 kB 12.2 MB/s
Collecting idna<3,>=2.5
Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
|████████████████████████████████| 58 kB 406 kB/s
Collecting oauthlib>=3.0.0
Downloading oauthlib-3.1.0-py2.py3-none-any.whl (147 kB)
|████████████████████████████████| 147 kB 12.8 MB/s
Collecting zipp>=0.5
Downloading zipp-1.2.0-py2.py3-none-any.whl (4.8 kB)
Building wheels for collected packages: termcolor, grpcio
Building wheel for termcolor (setup.py) ... done
Created wheel for termcolor: filename=termcolor-1.1.0-py3-none-any.whl size=5680 sha256=6c5b62ac33188a08e0ac2215404a793ba835e33a5b15a4cea664129aae623bfc
Stored in directory: /root/.cache/pip/wheels/91/0e/11/1f1321dce76e9c542907008e4a94ff79f8bf525a3fa32b09f3
Building wheel for grpcio (setup.py) ... done
Created wheel for grpcio: filename=grpcio-1.41.1-cp35-cp35m-linux_x86_64.whl size=37153962 sha256=cb6bb6bb7f1cfffb704bfd2d39136188f8feb5deb5c2ec474530936f29275a64
Stored in directory: /root/.cache/pip/wheels/3f/79/8e/2aa88c6daffd594ac957c188bb161d034e49ac39e535ea8be4
Successfully built termcolor grpcio
Installing collected packages: urllib3, pyasn1, idna, chardet, certifi, zipp, six, setuptools, rsa, requests, pyasn1-modules, oauthlib, cachetools, requests-oauthlib, importlib-metadata, google-auth, werkzeug, tensorboard-plugin-wit, protobuf, markdown, grpcio, google-auth-oauthlib, absl-py, wrapt, termcolor, tensorflow-estimator, tensorboard, opt-einsum, h5py, google-pasta, gast, astunparse, tensorflow
Attempting uninstall: chardet
Found existing installation: chardet 2.3.0
Uninstalling chardet-2.3.0:
Successfully uninstalled chardet-2.3.0
Attempting uninstall: six
Found existing installation: six 1.10.0
Uninstalling six-1.10.0:
Successfully uninstalled six-1.10.0
Attempting uninstall: setuptools
Found existing installation: setuptools 20.7.0
Uninstalling setuptools-20.7.0:
Successfully uninstalled setuptools-20.7.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
grpcio 1.41.1 requires enum34>=1.0.4, which is not installed.
grpcio 1.41.1 requires futures>=2.2.0, which is not installed.
Successfully installed absl-py-0.15.0 astunparse-1.6.3 cachetools-4.2.4 certifi-2021.10.8 chardet-4.0.0 gast-0.3.3 google-auth-1.23.0 google-auth-oauthlib-0.4.1 google-pasta-0.2.0 grpcio-1.41.1 h5py-2.10.0 idna-2.10 importlib-metadata-2.1.3 markdown-3.2.2 oauthlib-3.1.0 opt-einsum-3.3.0 protobuf-3.19.6 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-2.25.1 requests-oauthlib-1.3.1 rsa-4.7.2 setuptools-50.3.2 six-1.16.0 tensorboard-2.4.1 tensorboard-plugin-wit-1.8.1 tensorflow-2.3.1 tensorflow-estimator-2.3.0 termcolor-1.1.0 urllib3-1.26.9 werkzeug-1.0.1 wrapt-1.15.0 zipp-1.2.0


我要用的是 python 3.6.4
安裝 python 3.6.4 之後,下 pip3 -V 會出現

# pip3 -V
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)


安裝 numpy

root@ubuntu1604:/home/tensorflow# pip3 install numpy
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting numpy
Cache entry deserialization failed, entry ignored
Could not fetch URL https://pypi.python.org/simple/numpy/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy

查詢之後,說要安裝openssl 1.1.x以上的版本

安裝完 openssl ,再重新編譯 python 3.6.4

我這時下 make install 會出現

Exception:
Traceback (most recent call last):
File "/tmp/tmph5szf0lj/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/tmp/tmph5szf0lj/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 272, in run
with self._build_session(options) as session:
File "/tmp/tmph5szf0lj/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", line 72, in _build_session
insecure_hosts=options.trusted_hosts,
File "/tmp/tmph5szf0lj/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 329, in __init__
self.headers["User-Agent"] = user_agent()
File "/tmp/tmph5szf0lj/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 93, in user_agent
from pip._vendor import distro
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/tmp/tmph5szf0lj/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/distro.py", line 1050, in <module>
_distro = LinuxDistribution()
File "/tmp/tmph5szf0lj/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/distro.py", line 594, in __init__
if include_lsb else {}
File "/tmp/tmph5szf0lj/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/distro.py", line 931, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1.
Makefile:1099: recipe for target 'install' failed
make: *** [install] Error 2


這時下 pip3 install tensorflow 會出現

root@ubuntu1604:/home/# pip3 install tensorflow
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python3.6/site-packages/pip/commands/install.py", line 272, in run
with self._build_session(options) as session:
File "/usr/local/lib/python3.6/site-packages/pip/basecommand.py", line 72, in _build_session
insecure_hosts=options.trusted_hosts,
File "/usr/local/lib/python3.6/site-packages/pip/download.py", line 329, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.6/site-packages/pip/download.py", line 93, in user_agent
from pip._vendor import distro
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/distro.py", line 1050, in <module>
_distro = LinuxDistribution()
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/distro.py", line 594, in __init__
if include_lsb else {}
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/distro.py", line 931, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1.
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/site-packages/pip/__init__.py", line 233, in main
return command.main(cmd_args)
File "/usr/local/lib/python3.6/site-packages/pip/basecommand.py", line 251, in main
timeout=min(5, options.timeout)) as session:
File "/usr/local/lib/python3.6/site-packages/pip/basecommand.py", line 72, in _build_session
insecure_hosts=options.trusted_hosts,
File "/usr/local/lib/python3.6/site-packages/pip/download.py", line 329, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.6/site-packages/pip/download.py", line 93, in user_agent
from pip._vendor import distro
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/distro.py", line 1050, in <module>
_distro = LinuxDistribution()
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/distro.py", line 594, in __init__
if include_lsb else {}
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/distro.py", line 931, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1.


後來下 pip3 -V 會出現

root@ubuntu1604:/home/Python-3.6.4# pip3 -V
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip import main
ModuleNotFoundError: No module named 'pip'


解決方法是 (執行完之後,但打 make install 還是有問題,先不管它了)

wget https://bootstrap.pypa.io/pip/3.6/get-pip.py
python3 get-pip.py --force-reinstall

這時 pip 版本更新到 21.3.1 了

root@ubuntu1604:/home/tensorflow# pip3 -V
pip 21.3.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)


終於成功了

root@ubuntu1604:/home/Python-3.6.4# pip3 install tensorflow
Collecting tensorflow
Downloading tensorflow-2.6.2-cp36-cp36m-manylinux2010_x86_64.whl (458.3 MB)
|████████████████████████████████| 458.3 MB 4.5 kB/s
Collecting wrapt~=1.12.1
Downloading wrapt-1.12.1.tar.gz (27 kB)
Preparing metadata (setup.py) ... done
Collecting clang~=5.0
Downloading clang-5.0.tar.gz (30 kB)
Preparing metadata (setup.py) ... done
Collecting typing-extensions~=3.7.4
Downloading typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Collecting flatbuffers~=1.12.0
Downloading flatbuffers-1.12-py2.py3-none-any.whl (15 kB)
Collecting gast==0.4.0
Downloading gast-0.4.0-py3-none-any.whl (9.8 kB)
Collecting tensorflow-estimator<2.7,>=2.6.0
Downloading tensorflow_estimator-2.6.0-py2.py3-none-any.whl (462 kB)
|████████████████████████████████| 462 kB 13.6 MB/s
Collecting keras<2.7,>=2.6.0
Downloading keras-2.6.0-py2.py3-none-any.whl (1.3 MB)
|████████████████████████████████| 1.3 MB 13.2 MB/s
Collecting absl-py~=0.10
Using cached absl_py-0.15.0-py3-none-any.whl (132 kB)
Collecting tensorboard<2.7,>=2.6.0
Downloading tensorboard-2.6.0-py3-none-any.whl (5.6 MB)
|████████████████████████████████| 5.6 MB 13.9 MB/s
Collecting opt-einsum~=3.3.0
Using cached opt_einsum-3.3.0-py3-none-any.whl (65 kB)
Collecting astunparse~=1.6.3
Using cached astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Collecting google-pasta~=0.2
Using cached google_pasta-0.2.0-py3-none-any.whl (57 kB)
Collecting grpcio<2.0,>=1.37.0
Downloading grpcio-1.48.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.6 MB)
|████████████████████████████████| 4.6 MB 12.8 MB/s
Collecting protobuf>=3.9.2
Downloading protobuf-3.19.6-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB)
|████████████████████████████████| 1.1 MB 13.8 MB/s
Collecting termcolor~=1.1.0
Using cached termcolor-1.1.0.tar.gz (3.9 kB)
Preparing metadata (setup.py) ... done
Collecting numpy~=1.19.2
Downloading numpy-1.19.5-cp36-cp36m-manylinux2010_x86_64.whl (14.8 MB)
|████████████████████████████████| 14.8 MB 84 kB/s
Collecting six~=1.15.0
Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting h5py~=3.1.0
Downloading h5py-3.1.0-cp36-cp36m-manylinux1_x86_64.whl (4.0 MB)
|████████████████████████████████| 4.0 MB 12.8 MB/s
Requirement already satisfied: wheel~=0.35 in /usr/local/lib/python3.6/site-packages (from tensorflow) (0.37.1)
Collecting keras-preprocessing~=1.1.2
Using cached Keras_Preprocessing-1.1.2-py2.py3-none-any.whl (42 kB)
Collecting cached-property
Downloading cached_property-1.5.2-py2.py3-none-any.whl (7.6 kB)
Collecting google-auth-oauthlib<0.5,>=0.4.1
Downloading google_auth_oauthlib-0.4.6-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.6/site-packages (from tensorboard<2.7,>=2.6.0->tensorflow) (59.6.0)
Collecting requests<3,>=2.21.0
Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
|████████████████████████████████| 63 kB 54 kB/s
Collecting markdown>=2.6.8
Downloading Markdown-3.3.7-py3-none-any.whl (97 kB)
|████████████████████████████████| 97 kB 327 kB/s
Collecting google-auth<2,>=1.6.3
Downloading google_auth-1.35.0-py2.py3-none-any.whl (152 kB)
|████████████████████████████████| 152 kB 13.6 MB/s
Collecting werkzeug>=0.11.15
Downloading Werkzeug-2.0.3-py3-none-any.whl (289 kB)
|████████████████████████████████| 289 kB 13.5 MB/s
Collecting tensorboard-plugin-wit>=1.6.0
Using cached tensorboard_plugin_wit-1.8.1-py3-none-any.whl (781 kB)
Collecting tensorboard-data-server<0.7.0,>=0.6.0
Downloading tensorboard_data_server-0.6.1-py3-none-manylinux2010_x86_64.whl (4.9 MB)
|████████████████████████████████| 4.9 MB 13.7 MB/s
Collecting pyasn1-modules>=0.2.1
Downloading pyasn1_modules-0.3.0-py2.py3-none-any.whl (181 kB)
|████████████████████████████████| 181 kB 12.9 MB/s
Collecting cachetools<5.0,>=2.0.0
Using cached cachetools-4.2.4-py3-none-any.whl (10 kB)
Collecting rsa<5,>=3.1.4
Downloading rsa-4.9-py3-none-any.whl (34 kB)
Collecting requests-oauthlib>=0.7.0
Using cached requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)
Collecting importlib-metadata>=4.4
Downloading importlib_metadata-4.8.3-py3-none-any.whl (17 kB)
Collecting certifi>=2017.4.17
Downloading certifi-2023.7.22-py3-none-any.whl (158 kB)
|████████████████████████████████| 158 kB 12.6 MB/s
Collecting idna<4,>=2.5
Downloading idna-3.4-py3-none-any.whl (61 kB)
|████████████████████████████████| 61 kB 13 kB/s
Collecting urllib3<1.27,>=1.21.1
Downloading urllib3-1.26.16-py2.py3-none-any.whl (143 kB)
|████████████████████████████████| 143 kB 12.7 MB/s
Collecting charset-normalizer~=2.0.0
Downloading charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Collecting dataclasses
Downloading dataclasses-0.8-py3-none-any.whl (19 kB)
Collecting zipp>=0.5
Downloading zipp-3.6.0-py3-none-any.whl (5.3 kB)
Collecting pyasn1<0.6.0,>=0.4.6
Downloading pyasn1-0.5.0-py2.py3-none-any.whl (83 kB)
|████████████████████████████████| 83 kB 236 kB/s
Collecting oauthlib>=3.0.0
Downloading oauthlib-3.2.2-py3-none-any.whl (151 kB)
|████████████████████████████████| 151 kB 13.7 MB/s
Building wheels for collected packages: clang, termcolor, wrapt
Building wheel for clang (setup.py) ... done
Created wheel for clang: filename=clang-5.0-py3-none-any.whl size=30694 sha256=a1ba2d7e999d62e6211796d6625a64dab246f360102eb6fab86bf49d05e309c0
Stored in directory: /root/.cache/pip/wheels/22/4c/94/0583f60c9c5b6024ed64f290cb2d43b06bb4f75577dc3c93a7
Building wheel for termcolor (setup.py) ... done
Created wheel for termcolor: filename=termcolor-1.1.0-py3-none-any.whl size=4848 sha256=7af6065bdf3dfa949eacefe96f70bd3debacb210539c3364f4c95c4524b1bb1c
Stored in directory: /root/.cache/pip/wheels/93/2a/eb/e58dbcbc963549ee4f065ff80a59f274cc7210b6eab962acdc
Building wheel for wrapt (setup.py) ... done
Created wheel for wrapt: filename=wrapt-1.12.1-cp36-cp36m-linux_x86_64.whl size=66182 sha256=5a7ad9e90af94a8f43c9a7555ffbf6d7d882e4f6a2f784f8938191cd1289cad8
Stored in directory: /root/.cache/pip/wheels/32/42/7f/23cae9ff6ef66798d00dc5d659088e57dbba01566f6c60db63
Successfully built clang termcolor wrapt
Installing collected packages: urllib3, pyasn1, idna, charset-normalizer, certifi, zipp, typing-extensions, six, rsa, requests, pyasn1-modules, oauthlib, cachetools, requests-oauthlib, importlib-metadata, google-auth, dataclasses, werkzeug, tensorboard-plugin-wit, tensorboard-data-server, protobuf, numpy, markdown, grpcio, google-auth-oauthlib, cached-property, absl-py, wrapt, termcolor, tensorflow-estimator, tensorboard, opt-einsum, keras-preprocessing, keras, h5py, google-pasta, gast, flatbuffers, clang, astunparse, tensorflow
Successfully installed absl-py-0.15.0 astunparse-1.6.3 cached-property-1.5.2 cachetools-4.2.4 certifi-2023.7.22 charset-normalizer-2.0.12 clang-5.0 dataclasses-0.8 flatbuffers-1.12 gast-0.4.0 google-auth-1.35.0 google-auth-oauthlib-0.4.6 google-pasta-0.2.0 grpcio-1.48.2 h5py-3.1.0 idna-3.4 importlib-metadata-4.8.3 keras-2.6.0 keras-preprocessing-1.1.2 markdown-3.3.7 numpy-1.19.5 oauthlib-3.2.2 opt-einsum-3.3.0 protobuf-3.19.6 pyasn1-0.5.0 pyasn1-modules-0.3.0 requests-2.27.1 requests-oauthlib-1.3.1 rsa-4.9 six-1.15.0 tensorboard-2.6.0 tensorboard-data-server-0.6.1 tensorboard-plugin-wit-1.8.1 tensorflow-2.6.2 tensorflow-estimator-2.6.0 termcolor-1.1.0 typing-extensions-3.7.4.3 urllib3-1.26.16 werkzeug-2.0.3 wrapt-1.12.1 zipp-3.6.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv


安裝完 tensorflow 會把需要的 lib 都裝好了
也看他是裝了tensorflow的什麼版本
等等make一樣的版本就行 

這時可以

pip3 uninstall tensorflow


再去 make tensorflow



番外:

將lib放到另一台機器上,執行時會出現 

ValueError: failed to parse CPython sys.version: '3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) \n[GCC 7.2.0]'

要把 /usr/local/anaconda3/lib/python3.6/platform.py 的

_sys_version_parser = re.compile(
r'([\w.+]+)\s*' # "version<space>"
r'\(#?([^,]+)' # "(#buildno"
r'(?:,\s*([\w ]*)' # ", builddate"
r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)<space>"
r'\[([^\]]+)\]?', re.ASCII) # "[compiler]"

插入紅色的部份

_sys_version_parser = re.compile(
r
'([\w.+]+)\s*' # "version<space>"
r'(?:\|[^|]*\|)?\s*' # version extra
r
'\(#?([^,]+)' # "(#buildno"
r'(?:,\s*([\w ]*)' # ", builddate"
r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)<space>"
r'\[([^\]]+)\]?', re.ASCII) # "[compiler]"








沒有留言:

張貼留言