py3.8.2
尝试的方法1:
Tensorflow installation in Mac M1 (from source):
1) open Terminal Get Info and enable "Open using Rosetta" (duplicate Terminal app for this and open Rosetta terminal)
2) git clone https://github.com/tensorflow/tensorflow.git
3) cd tensorflow
4) git checkout branch_name (for us: v2.4.1)
5) ./configure (say N to everything, leave default config)
6) bazel build //tensorflow/tools/pip_package:build_pip_package (takes approximately ~5 hours)
7) rename .whl file to disable OS restrictions (us: tensorflow-2.4.1-py3-none-any.whl)
8) pip install /tmp/tensorflow_pkg/tensorflow-2.4.1-py3-none-any.whl (enable --force-reinstall if TF already installed)
And you are done! Try to run a few code snippets to see if your TF setup is working.
If you have python 3.8.5, you can skip steps 2-7 and run step 8 with the .whl file here (for TF 2.4.1).
The following .whl files work for python 3.7 and TF 1.15.0, 2.4.1, and 2.5.0:
https://drive.google.com/drive/folders/11cACNiynhi45br1aW3ub5oQ6SrDEQx4p
上面失败了。。
尝试的方法2:
参考:
https://github.com/apple/tensorflow_macos/
https://zhuanlan.zhihu.com/p/426280062
一定要把相关的依赖包装好
下载两个文件
tensorflow_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl
tensorflow_addons_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl
pip install --upgrade --force --no-dependencies tensorflow_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl tensorflow_addons_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl
尝试的方法1:
https://github.com/grpc/grpc/issues/25082
I had to set a few environment variables to get it to work:
GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1
to make the installation process use the libraries I've already got on the system, and then the following to point it at OpenSSL installed via Homebrew:
CFLAGS="-I/opt/homebrew/opt/openssl/include"
LDFLAGS="-L/opt/homebrew/opt/openssl/lib"
上面没啥用,可能是我的问题,要设置环境变量 .bash_profile
尝试的方法2:
下载源代码,按照官方教程进行安装:
[En]
Download the source code and install it according to the official tutorial:
https://pypi.org/project/grpcio/1.44.0/#description
$ export REPO_ROOT=grpc
$ git clone -b RELEASE_TAG_HERE https://github.com/grpc/grpc $REPO_ROOT
$ cd $REPO_ROOT
$ git submodule update --init
$ pip install -rrequirements.txt
$ GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install .
尝试的方法3:
https://github.com/grpc/grpc/issues/25082
mkdir grpctest
cd grpctest
/usr/bin/python3 -m pip install virtualenv
/usr/bin/python3 -m virtualenv venv
source venv/bin/activate __
arch -x86_64 pip install --upgrade pip setuptools
arch -x86_64 pip install grpcio
arch -x86_64 pip install grpcio-tools
touch test.proto
...
arch -x86_64 python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. test.proto
touch main.py
arch -x86_64 python main.py
使用的代码行已成功安装:
[En]
The line of code used has been successfully installed:
arch -x86_64 pip install grpcio
代码问题
from layer import layer
改为:
下一个tf_slim库
from tf_slim import layers as layer
Original: https://blog.csdn.net/weixin_39712314/article/details/123585489
Author: kukufufu
Title: M1 安装tensorflow python3.8.2
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/509360/
转载文章受原作者版权保护。转载请注明原作者出处!