Python11中创建虚拟环境、安装 TensorFlow
1. 为什么必须使用虚拟环境?
避免污染系统环境:TensorFlow 依赖复杂,可能与其他包冲突
隔离 Python 版本:防止 Python 11 和 Python 13 相互干扰
项目独立性:方便管理不同项目的依赖
卸载简单:直接删除文件夹即可清理环境
2. 创建虚拟环境(关键步骤)
验证版本
PS J:\Program Files (x86)\Python\python-3.11.0> python --version
Python 3.11.0
创建虚拟环境(关键步骤)
python -m venv "J:\Prog\python\tf_env"
几秒后完成
3. 激活虚拟环境
进入虚拟环境目录
cd "J:\Prog\python\tf_env\Scripts"
打开powershell
- 导航到 Scripts 目录
cd J:\Prog\python\tf_env\Scripts - 临时修改执行策略
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force - 执行激活脚本
.\Activate.ps1
4. 验证环境状态、环境变量
python check_env.py
import sys, os
print(f"Python 路径: {sys.executable}")
print(f"虚拟环境: {os.getenv('VIRTUAL_ENV', '未激活')}")
print(f"环境包目录: {sys.prefix}")
环境激活后
(tf_env) PS J:\Prog\python\tf_env\Scripts> pip --version
pip 22.3 from J:\Prog\python\tf_env\Lib\site-packages\pip (python 3.11)
当虚拟环境成功激活后,运行 pip --version 的输出应该显示虚拟环境内部的 pip 路径,而不是系统全局路径。
检查环境变量
- 检查 VIRTUAL_ENV 变量
$env:VIRTUAL_ENV
正确应显示:J:\Prog\python\tf_env
- 检查 PATH 变量
(tf_env) PS J:\Prog\python\tf_env\Scripts> $env:PATH -split ‘;’ | Select-String ‘tf_env’
正确应显示:J:\Prog\python\tf_env\Scripts
确定环境已激活
激活状态检查清单
命令提示符显示 (tf_env) 前缀
pip --version 显示虚拟环境路径
python -c “import sys; print(sys.executable)” 输出虚拟环境路径
$env:VIRTUAL_ENV 返回虚拟环境目录
where python 首先列出虚拟环境的 python.exe
如果所有这些检查都通过,您的虚拟环境已正确激活,可以安全安装 TensorFlow 而不会影响系统全局环境。
4. 停用环境:
deactivate.bat
5. 删除虚拟环境
Remove-Item -Recurse -Force J:\Prog\python\tf_env
6. 虚拟环境中安装 TensorFlow
pip install tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple
(tf_env) PS J:\Prog\python\tf_env\Scripts> pip install tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting tensorflowDownloading https://pypi.tuna.tsinghua.edu.cn/packages/3c/e3/e868f1d5951047f950d2ba1e04a765a3328a51f06996b67976d6102f8227/tensorflow-2.19.0-cp311-cp311-win_amd64.whl (375.9 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 375.9/375.9 MB 6.9 MB/s eta 0:00:00
Collecting absl-py>=1.0.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/8f/aa/ba0014cc4659328dc818a28827be78e6d97312ab0cb98105a770924dc11e/absl_py-2.3.1-py3-none-any.whl (135 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 135.8/135.8 kB 8.4 MB/s eta 0:00:00
Collecting astunparse>=1.6.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2b/03/13dde6512ad7b4557eb792fbcf0c653af6076b81e5941d36ec61f7ce6028/astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Collecting flatbuffers>=24.3.25Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b8/25/155f9f080d5e4bc0082edfda032ea2bc2b8fab3f4d25d46c1e9dd22a1a89/flatbuffers-25.2.10-py2.py3-none-any.whl (30 kB)
Collecting gast!=0.5.0,!=0.5.1,!=0.5.2,>=0.2.1Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a3/61/8001b38461d751cd1a0c3a6ae84346796a5758123f3ed97a1b121dfbf4f3/gast-0.6.0-py3-none-any.whl (21 kB)
Collecting google-pasta>=0.1.1Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a3/de/c648ef6835192e6e2cc03f40b19eeda4382c49b5bafb43d88b931c4c74ac/google_pasta-0.2.0-py3-none-any.whl (57 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.5/57.5 kB 3.0 MB/s eta 0:00:00
Collecting libclang>=13.0.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/0b/2d/3f480b1e1d31eb3d6de5e3ef641954e5c67430d5ac93b7fa7e07589576c7/libclang-18.1.1-py2.py3-none-win_amd64.whl (26.4 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 26.4/26.4 MB 38.6 MB/s eta 0:00:00
Collecting opt-einsum>=2.3.2Downloading https://pypi.tuna.tsinghua.edu.cn/packages/23/cd/066e86230ae37ed0be70aae89aabf03ca8d9f39c8aea0dec8029455b5540/opt_einsum-3.4.0-py3-none-any.whl (71 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 71.9/71.9 kB ? eta 0:00:00
Collecting packagingDownloading https://pypi.tuna.tsinghua.edu.cn/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl (66 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.5/66.5 kB ? eta 0:00:00
Collecting protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<6.0.0dev,>=3.20.3Downloading https://pypi.tuna.tsinghua.edu.cn/packages/81/7f/73cefb093e1a2a7c3ffd839e6f9fcafb7a427d300c7f8aef9c64405d8ac6/protobuf-5.29.5-cp310-abi3-win_amd64.whl (434 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 434.8/434.8 kB 26.5 MB/s eta 0:00:00
Collecting requests<3,>=2.21.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/7c/e4/56027c4a6b4ae70ca9de302488c5ca95ad4a39e190093d6c1a8ace08341b/requests-2.32.4-py3-none-any.whl (64 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.8/64.8 kB ? eta 0:00:00
Requirement already satisfied: setuptools in j:\prog\python\tf_env\lib\site-packages (from tensorflow) (65.5.0)
Collecting six>=1.12.0Using cached https://pypi.tuna.tsinghua.edu.cn/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl (11 kB)
Collecting termcolor>=1.1.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/4f/bd/de8d508070629b6d84a30d01d57e4a65c69aa7f5abe7560b8fad3b50ea59/termcolor-3.1.0-py3-none-any.whl (7.7 kB)
Collecting typing-extensions>=3.6.6Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b5/00/d631e67a838026495268c2f6884f3711a15a9a2a96cd244fdaea53b823fb/typing_extensions-4.14.1-py3-none-any.whl (43 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.9/43.9 kB ? eta 0:00:00
Collecting wrapt>=1.11.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/47/f8/fb1773491a253cbc123c5d5dc15c86041f746ed30416535f2a8df1f4a392/wrapt-1.17.2-cp311-cp311-win_amd64.whl (38 kB)
Collecting grpcio<2.0,>=1.24.3Downloading https://pypi.tuna.tsinghua.edu.cn/packages/af/66/e1bbb0c95ea222947f0829b3db7692c59b59bcc531df84442e413fa983d9/grpcio-1.73.1-cp311-cp311-win_amd64.whl (4.3 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 34.7 MB/s eta 0:00:00
Collecting tensorboard~=2.19.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/5d/12/4f70e8e2ba0dbe72ea978429d8530b0333f0ed2140cc571a48802878ef99/tensorboard-2.19.0-py3-none-any.whl (5.5 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.5/5.5 MB 58.4 MB/s eta 0:00:00
Collecting keras>=3.5.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/95/e6/4179c461a5fc43e3736880f64dbdc9b1a5349649f0ae32ded927c0e3a227/keras-3.10.0-py3-none-any.whl (1.4 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 85.6 MB/s eta 0:00:00
Collecting numpy<2.2.0,>=1.26.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/1e/48/a9a4b538e28f854bfb62e1dea3c8fea12e90216a276c7777ae5345ff29a7/numpy-2.1.3-cp311-cp311-win_amd64.whl (12.9 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.9/12.9 MB 50.4 MB/s eta 0:00:00
Collecting h5py>=3.11.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/db/0c/6c3f879a0f8e891625817637fad902da6e764e36919ed091dc77529004ac/h5py-3.14.0-cp311-cp311-win_amd64.whl (2.9 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.9/2.9 MB 92.4 MB/s eta 0:00:00
Collecting ml-dtypes<1.0.0,>=0.5.1Downloading https://pypi.tuna.tsinghua.edu.cn/packages/60/30/d3f0fc9499a22801219679a7f3f8d59f1429943c6261f445fb4bfce20718/ml_dtypes-0.5.1-cp311-cp311-win_amd64.whl (209 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 209.7/209.7 kB ? eta 0:00:00
Collecting tensorflow-io-gcs-filesystem>=0.23.1Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ac/4e/9566a313927be582ca99455a9523a097c7888fc819695bdc08415432b202/tensorflow_io_gcs_filesystem-0.31.0-cp311-cp311-win_amd64.whl (1.5 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 47.6 MB/s eta 0:00:00
Collecting wheel<1.0,>=0.23.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/0b/2c/87f3254fd8ffd29e4c02732eee68a83a1d3c346ae39bc6822dcbcb697f2b/wheel-0.45.1-py3-none-any.whl (72 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 72.5/72.5 kB ? eta 0:00:00
Collecting richDownloading https://pypi.tuna.tsinghua.edu.cn/packages/0d/9b/63f4c7ebc259242c89b3acafdb37b41d1185c07ff0011164674e9076b491/rich-14.0.0-py3-none-any.whl (243 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 243.2/243.2 kB 14.6 MB/s eta 0:00:00
Collecting namexDownloading https://pypi.tuna.tsinghua.edu.cn/packages/b2/bc/465daf1de06409cdd4532082806770ee0d8d7df434da79c76564d0f69741/namex-0.1.0-py3-none-any.whl (5.9 kB)
Collecting optreeDownloading https://pypi.tuna.tsinghua.edu.cn/packages/a2/24/f29c7c819402b342020622304092a1607d6e8e8ede76610a3075663a19a7/optree-0.16.0-cp311-cp311-win_amd64.whl (314 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 314.2/314.2 kB ? eta 0:00:00
Collecting charset_normalizer<4,>=2Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a8/05/5e33dbef7e2f773d672b6d79f10ec633d4a71cd96db6673625838a4fd532/charset_normalizer-3.4.2-cp311-cp311-win_amd64.whl (105 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 105.4/105.4 kB ? eta 0:00:00
Collecting idna<4,>=2.5Downloading https://pypi.tuna.tsinghua.edu.cn/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl (70 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 70.4/70.4 kB 154.0 kB/s eta 0:00:00
Collecting urllib3<3,>=1.21.1Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a7/c2/fe1e52489ae3122415c51f387e221dd0773709bad6c6cdaa599e8a2c5185/urllib3-2.5.0-py3-none-any.whl (129 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 129.8/129.8 kB 383.2 kB/s eta 0:00:00
Collecting certifi>=2017.4.17Downloading https://pypi.tuna.tsinghua.edu.cn/packages/84/ae/320161bd181fc06471eed047ecce67b693fd7515b16d495d8932db763426/certifi-2025.6.15-py3-none-any.whl (157 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 157.7/157.7 kB 1.2 MB/s eta 0:00:00
Collecting markdown>=2.6.8Downloading https://pypi.tuna.tsinghua.edu.cn/packages/96/2b/34cc11786bc00d0f04d0f5fdc3a2b1ae0b6239eef72d3d345805f9ad92a1/markdown-3.8.2-py3-none-any.whl (106 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 106.8/106.8 kB 1.2 MB/s eta 0:00:00
Collecting tensorboard-data-server<0.8.0,>=0.7.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/7a/13/e503968fefabd4c6b2650af21e110aa8466fe21432cd7c43a84577a89438/tensorboard_data_server-0.7.2-py3-none-any.whl (2.4 kB)
Collecting werkzeug>=1.0.1Downloading https://pypi.tuna.tsinghua.edu.cn/packages/52/24/ab44c871b0f07f491e5d2ad12c9bd7358e527510618cb1b803a88e986db1/werkzeug-3.1.3-py3-none-any.whl (224 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 224.5/224.5 kB 2.3 MB/s eta 0:00:00
Collecting MarkupSafe>=2.1.1Downloading https://pypi.tuna.tsinghua.edu.cn/packages/da/b8/3a3bd761922d416f3dc5d00bfbed11f66b1ab89a0c2b6e887240a30b0f6b/MarkupSafe-3.0.2-cp311-cp311-win_amd64.whl (15 kB)
Collecting markdown-it-py>=2.2.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/42/d7/1ec15b46af6af88f19b8e5ffea08fa375d433c998b8a7639e76935c14f1f/markdown_it_py-3.0.0-py3-none-any.whl (87 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.5/87.5 kB 4.8 MB/s eta 0:00:00
Collecting pygments<3.0.0,>=2.13.0Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl (1.2 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 4.9 MB/s eta 0:00:00
Collecting mdurl~=0.1Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Installing collected packages: namex, libclang, flatbuffers, wrapt, wheel, urllib3, typing-extensions, termcolor, tensorflow-io-gcs-filesystem, tensorboard-data-server, six, pygments, protobuf, packaging, opt-einsum, numpy, mdurl, MarkupSafe, markdown, idna, grpcio, gast, charset_normalizer, certifi, absl-py, werkzeug, requests, optree, ml-dtypes, markdown-it-py, h5py, google-pasta, astunparse, tensorboard, rich, keras, tensorflow
Successfully installed MarkupSafe-3.0.2 absl-py-2.3.1 astunparse-1.6.3 certifi-2025.6.15 charset_normalizer-3.4.2 flatbuffers-25.2.10 gast-0.6.0 google-pasta-0.2.0 grpcio-1.73.1 h5py-3.14.0 idna-3.10 keras-3.10.0 libclang-18.1.1 markdown-3.8.2 markdown-it-py-3.0.0 mdurl-0.1.2 ml-dtypes-0.5.1 namex-0.1.0 numpy-2.1.3 opt-einsum-3.4.0 optree-0.16.0 packaging-25.0 protobuf-5.29.5 pygments-2.19.2 requests-2.32.4 rich-14.0.0 six-1.17.0 tensorboard-2.19.0 tensorboard-data-server-0.7.2 tensorflow-2.19.0 tensorflow-io-gcs-filesystem-0.31.0 termcolor-3.1.0 typing-extensions-4.14.1 urllib3-2.5.0 werkzeug-3.1.3 wheel-0.45.1 wrapt-1.17.2[notice] A new release of pip available: 22.3 -> 25.1.1
[notice] To update, run: python.exe -m pip install --upgrade pip
(tf_env) PS J:\Prog\python\tf_env\Scripts> python.exe -m pip install --upgrade pip
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: pip in j:\prog\python\tf_env\lib\site-packages (22.3)
Collecting pipUsing cached https://pypi.tuna.tsinghua.edu.cn/packages/29/a2/d40fb2460e883eca5199c62cfc2463fd261f760556ae6290f88488c362c0/pip-25.1.1-py3-none-any.whl (1.8 MB)
Installing collected packages: pipAttempting uninstall: pipFound existing installation: pip 22.3Uninstalling pip-22.3:Successfully uninstalled pip-22.3
Successfully installed pip-25.1.1
(tf_env) PS J:\Prog\python\tf_env\Scripts> python -c "import tensorflow as tf; print(f'TensorFlow版本: {tf.__version__}')"
2025-07-06 17:03:37.749722: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2025-07-06 17:03:40.298292: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
TensorFlow版本: 2.19.0
进一步验证 GPU 支持
python -c “import tensorflow as tf; print(‘GPU 可用:’, ‘是’ if tf.config.list_physical_devices(‘GPU’) else ‘否’)”
运行简单测试,在(tf_env) PS J:\Prog\python\tf_env\Scripts> 复制上去就可以了
# 创建正确的测试脚本
@"
import tensorflow as tfprint(f"TensorFlow 版本: {tf.__version__}")
print(f"GPU 设备: {tf.config.list_physical_devices('GPU')}")# 简单计算
a = tf.constant([1, 2, 3])
b = tf.constant([4, 5, 6])
c = tf.add(a, b)print(f"加法结果: {c.numpy()}")
"@ | Set-Content -Path tf_test.py -Encoding UTF8# 运行测试
python tf_test.py
测试TensorFlow是否正常
python -c "import tensorflow as tf; print('TensorFlow 工作正常! 版本:', tf.__version__)"
(tf_env) PS J:\Prog\python\tf_env\Scripts> python -c “import tensorflow as tf; print(‘TensorFlow 工作正常! 版本:’, tf.version)”
2025-07-06 17:17:22.539651: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0
.
2025-07-06 17:17:23.361411: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0
.
TensorFlow 工作正常! 版本: 2.19.0
7. 后续步骤建议
安装常用配套库:
powershell
pip install numpy pandas matplotlib scikit-learn -i https://pypi.tuna.tsinghua.edu.cn/simple
保存环境配置:
powershell
pip freeze > requirements.txt
我们已经成功安装了TensorFlow,并且当前在虚拟环境tf_env中。现在执行pip freeze > requirements.txt
命令的目的是将当前虚拟环境中安装的所有Python包及其精确版本号导出到一个名为requirements.txt
的文件中。这样做的目的是为了以后可以轻松地重建相同的环境(例如,在另一台机器上或重新安装时)。
在 J:\Prog\python\tf_env\Scripts 目录下生成 requirements.txt 文件
//requirements.txt
absl-py==2.3.1
astunparse==1.6.3
certifi==2025.6.15
charset-normalizer==3.4.2
contourpy==1.3.2
cycler==0.12.1
flatbuffers==25.2.10
fonttools==4.58.5
gast==0.6.0
google-pasta==0.2.0
grpcio==1.73.1
h5py==3.14.0
idna==3.10
joblib==1.5.1
keras==3.10.0
kiwisolver==1.4.8
libclang==18.1.1
Markdown==3.8.2
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.10.3
mdurl==0.1.2
ml_dtypes==0.5.1
namex==0.1.0
numpy==2.1.3
opt_einsum==3.4.0
optree==0.16.0
packaging==25.0
pandas==2.3.0
pillow==11.3.0
protobuf==5.29.5
Pygments==2.19.2
pyparsing==3.2.3
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.32.4
rich==14.0.0
scikit-learn==1.7.0
scipy==1.16.0
six==1.17.0
tensorboard==2.19.0
tensorboard-data-server==0.7.2
tensorflow==2.19.0
tensorflow-io-gcs-filesystem==0.31.0
termcolor==3.1.0
threadpoolctl==3.6.0
typing_extensions==4.14.1
tzdata==2025.2
urllib3==2.5.0
Werkzeug==3.1.3
wrapt==1.17.2
pip install -r requirements.txt
这个 requirements.txt 文件是您 TensorFlow 环境的重要快照,建议妥善保存。它使得在任何地方重建相同的开发环境成为可能。
完成之后环境大小: