tensorflow2图像分割环境配置:
import tensorflow as tf
from tensorflow_examples.models.pix2pix import pix2pix
import tensorflow_datasets as tfds
tfds.disable_progress_bar()
from IPython.display import clear_output
import matplotlib.pyplot as plt
主要是“from tensorflow_examples.models.pix2pix import pix2pix”这句环境配置问题
pycharm中搜索不到这个库:

而使用pip安装提示如下:
pip install -q git+https://github.com/tensorflow/examples.git 错误提示

D:\PycharmProjects\pythonProject\venv\Scripts>pip install -q git+https://github.
com/tensorflow/examples.git
ERROR: Error [WinError 2] 系统找不到指定的文件。 while executing command git c
lone -q https://github.com/tensorflow/examples.git 'C:\Users\ADMINI~1\AppData\Lo
cal\Temp\pip-req-build-j23p9tfc'
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?
WARNING: You are using pip version 21.1.2; however, version 21.1.3 is available.
You should consider upgrading via the 'd:\pycharmprojects\pythonproject\venv\scr
ipts\python.exe -m pip install --upgrade pip' command.
根据提示,我们升级一下pip为21.1.3版本

点击+号添加库:

点击“Install Package”。


pycharm安装git,点击test提示没有安装git,点击下载安装。


安装失败:

进入官网下载一个安装:
https://git-scm.com/download/win

下载最新版本试试:Click here to download manually

安装,一路下一步,无数配置选项窗口,一路默认。












这里可以参考:GitHub教程 Git Bash详细教程
pycharm配置:

重新安装“pip install -q git+https://github.com/tensorflow/examples.git”,继续报错

重新运行一遍,后面就没反应了。


D:\PycharmProjects\pythonProject\venv\Scripts>pip install -q git+https://github.
com/tensorflow/examples.git
ERROR: Command errored out with exit status 128:
command: git clone -q https://github.com/tensorflow/examples.git 'C:\Users\AD
MINI~1\AppData\Local\Temp\pip-req-build-q1mbvgyd'
cwd: None
Complete output (1 lines):
fatal: unable to access 'https://github.com/tensorflow/examples.git/': Failed
to connect to github.com port 443: Connection refused
----------------------------------------
WARNING: Discarding git+https://github.com/tensorflow/examples.git. Command erro
red out with exit status 128: git clone -q https://github.com/tensorflow/example
s.git 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-q1mbvgyd' Check the lo
gs for full command output.
ERROR: Command errored out with exit status 128: git clone -q https://github.com
/tensorflow/examples.git 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-req-build-q1m
bvgyd' Check the logs for full command output.
D:\PycharmProjects\pythonProject\venv\Scripts>pip install -q git+https://github.
com/tensorflow/examples.git
WARNING: Built wheel for tensorflow-examples is invalid: Metadata 1.2 mandates
PEP 440 version, but '2a49e4e34d6fbfe2ce1451797026856edfda02fa-' is not
DEPRECATION: tensorflow-examples was installed using the legacy 'setup.py inst
all' method, because a wheel could not be built for it. A possible replacement i
s to fix the wheel build issue reported above. You can find discussion regarding
this at https://github.com/pypa/pip/issues/8368.
搞了这么久还是有问题
后面又用手机网络下载试试,成功安装上了。


800



被折叠的 条评论
为什么被折叠?



