python 在安装tensortflow时报错,报错代码粘贴在这里了
Collecting gast==0.2.2
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/4e/35/11749bf99b2d4e3cceb4d55ca22590b0d7c2c62b9de38ac4a4a7f4687421/gast-0.2.2.tar.gz (10 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [25 lines of output]
C:\Users\hasee\Anaconda3\lib\site-packages\setuptools\_importlib.py:23: UserWarning: `importlib-metadata` version is incompatible with `setuptools`.
This problem is likely to be solved by installing an updated version of `importlib-metadata`.
warnings.warn(msg) # Ensure a descriptive message is shown.
Traceback (most recent call last):
File "<string>", line 36, in <module>
File "<pip-setuptools-caller>", line 14, in <module>
File "C:\Users\hasee\Anaconda3\lib\site-packages\setuptools\__init__.py", line 18, in <module>
from setuptools.dist import Distribution
File "C:\Users\hasee\Anaconda3\lib\site-packages\setuptools\dist.py", line 34, in <module>
from ._importlib import metadata
File "C:\Users\hasee\Anaconda3\lib\site-packages\setuptools\_importlib.py", line 39, in <module>
disable_importlib_metadata_finder(metadata)
File "C:\Users\hasee\Anaconda3\lib\site-packages\setuptools\_importlib.py", line 12, in disable_importlib_metadata_finder
import importlib_metadata
File "C:\Users\hasee\Anaconda3\lib\site-packages\importlib_metadata\__init__.py", line 17, in <module>
__version__ = version(__name__)
File "C:\Users\hasee\Anaconda3\lib\site-packages\importlib_metadata\api.py", line 345, in version
return distribution(package).version
File "C:\Users\hasee\Anaconda3\lib\site-packages\importlib_metadata\api.py", line 310, in distribution
return Distribution.from_name(package)
File "C:\Users\hasee\Anaconda3\lib\site-packages\importlib_metadata\api.py", line 153, in from_name
dists = resolver(name)
File "C:\Users\hasee\Anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 886, in find_distributions
found = self._search_paths(context.name, context.path)
AttributeError: 'str' object has no attribute 'name'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
C:\Users\hasee>conda install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-cpu==2.1
C:\Users\hasee\Anaconda3\lib\site-packages\setuptools\_importlib.py:23: UserWarning: `importlib-metadata` version is incompatible with `setuptools`.
This problem is likely to be solved by installing an updated version of `importlib-metadata`.
warnings.warn(msg) # Ensure a descriptive message is shown.
usage: conda-script.py [-h] [-V] command ...
conda-script.py: error: unrecognized arguments: -i
C:\Users\hasee>conda install tensorflow-cpu==2.1
C:\Users\hasee\Anaconda3\lib\site-packages\setuptools\_importlib.py:23: UserWarning: `importlib-metadata` version is incompatible with `setuptools`.
This problem is likely to be solved by installing an updated version of `importlib-metadata`.
warnings.warn(msg) # Ensure a descriptive message is shown.
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- tensorflow-cpu==2.1
Current channels:
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.