我确定我使用的是 3.6 版本,并且我尝试了一切。
这是我尝试过的:
py -m pip install tensorflow
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
PS C:\Users\skarl> pip install tensorflow
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
[notice] A new release of pip is available: 23.2.1 -> 23.3.2
[notice] To update, run: C:\Users\skarl\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip
PS C:\Users\skarl> -m pip install --upgrade pip
-m : The term '-m' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ -m pip install --upgrade pip
+ ~~
+ CategoryInfo : ObjectNotFound: (-m:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\skarl> py -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\skarl\appdata\local\programs\python\python312\lib\site-packages (23.3.2)
我原以为它会起作用,但它没有。怎么了?
更仔细地阅读错误消息:
Defaulting to user installation because normal site-packages is not writeable
您似乎正在尝试将软件包安装到不允许的位置。也许您可以创建一个虚拟环境。否则请管理员帮助或以管理员身份运行终端。
To update, run: C:\Users\skarl\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip
这表示使用参数运行Python
-m pip install --upgrade pip
,而不是像运行有效命令一样运行参数,这就是你尝试过的:
-m pip install --upgrade pip
那是行不通的。要么是这个:
python -m pip install --upgrade pip
但更有可能正是错误消息所建议的,使用 Python 的完整路径,因为它可能不在您的路径上(这通常是一件好事)。