为什么从PowerShell安装程序包时出错

2024-05-23 20:16:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在尝试从PowerShell管理软件包,但似乎PowerShell出现了错误,因为他找不到软件包或其依赖项(我使用Chocolate作为源) 命令和结果:

register-packagesource -name chocolatey -providername chocolatey -location https://chocolatey.org/api/v2

Name                             ProviderName     IsTrusted  Location
----                             ------------     ---------  --------
chocolatey                       Chocolatey       False      https://chocolatey.org/api/v2
find-package -providername chocolatey -name notepad

Name                           Version          Source           Summary
----                           -------          ------           -------
xml-notepad                    2.8.0.7          chocolatey       A simple XML editor.
crypto-notepad                 1.6.7            chocolatey       Crypto Notepad allows you to create secure notes using AES algorithms.
ProgrammersNotepad             2.4.2            chocolatey       Programmer's Notepad is a fast, lightweight text editor for Windows.
programmersnotepad.install     2.4.2            chocolatey       Programmer's Notepad is a fast, lightweight text editor for Windows.
notepad2                       4.2.25.20160422  chocolatey       A fast and light-weight Notepad-like text editor with syntax highlighting.
notepadplusplus.install        7.8.9            chocolatey       Notepad++ is a free (as in "free speech" and also as in "free beer") source code editor and Notepad replacement that supports several languages.
notepadplusplus                7.8.9            chocolatey       Notepad++ is a free (as in "free speech" and also as in "free beer") source code editor and Notepad replacement that supports several languages.
install-package -providername chocolatey -name notepadplusplus

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'chocolatey'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
WARNING: NuGet: System.InvalidOperationException: Unable to find version '1.3.5.1' of package 'chocolatey-core.extension'.
WARNING: NuGet:    at NuGet.PackageRepositoryHelper.ResolvePackage(IPackageRepository sourceRepository, IPackageRepository localRepository, IPackageConstraintProvider constraintProvider, String packageId, SemanticVersion version,
Boolean allowPrereleaseVersions)
WARNING: NuGet:    at NuGet.PackageManager.InstallPackage(String packageId, SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions)
WARNING: NuGet:    at NuGet.Commands.InstallCommand.InstallPackage(IFileSystem fileSystem, String packageId, SemanticVersion version)
WARNING: NuGet:    at NuGet.Program.Main(String[] args)
WARNING: NuGet: System.InvalidOperationException: Unable to find version '7.8.9' of package 'notepadplusplus.install'.
WARNING: NuGet: System.InvalidOperationException: Unable to find version '7.8.9' of package 'notepadplusplus'.

我从install package命令后的错误中了解到,这些错误是找不到程序和程序的依赖项。尽管我确实使用find包找到了'chocolate core.extension',正如您在下面看到的,以及第二个命令中看到的程序本身。我尝试以同样的方式安装其他软件包,但没有成功

find-package -providername chocolatey -name chocolatey-core.extension

Name                           Version          Source           Summary
----                           -------          ------           -------
chocolatey-core.extension      1.3.5.1          chocolatey       Helper functions extending core choco functionality

非常感谢您的帮助,提前谢谢您


Tags: installandtofreepackageisversionplus