从 Windows 商店安装中手动安装 Python PIP 包的问题

Issue installing Python PIP package manually from Windows Store installation

我 运行 Python 通过 Windows 商店安装,当我去手动安装软件包时,我收到一条关于使用 'easy_install'.我的版本是 Python 3.9。前进的最佳方式是什么?

python setup.py install

running install error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the installation directory:

[Errno 13] Permission denied: 'C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\Lib\site-packages\test-easy-install-7300.write-test'

The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was:

C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\Lib\site-packages\

Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable.

For information on other options, you may wish to consult the documentation at:

https://setuptools.readthedocs.io/en/latest/deprecated/easy_install.html

Please make the appropriate changes for your system and try again.

第一步:下载PIP获取-pip.py 在安装 PIP 之前,下载 get-pip.py 文件。 https://bootstrap.pypa.io/get-pip.py

  1. 启动命令提示符(如果尚未打开)。为此,请打开 Windows 搜索栏,键入 cmd 并单击图标。

  2. 然后,运行以下命令下载get-pip.py文件:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 下载 PIP 软件包。 第 2 步:在 Windows 上安装 PIP 要安装 PIP,请输入以下内容:

python得到-pip.py 在 Windows 上安装 PIP。 如果找不到文件,请仔细检查保存文件的文件夹路径。您可以使用以下命令查看当前目录的内容:

目录 dir 命令 returns 目录内容的完整列表。

第 3 步:验证安装 一旦你安装了 PIP,你可以通过输入以下命令来测试安装是否成功:

点帮助 如果已安装 PIP,程序 运行s,您应该会看到软件包的位置和可以与 pip 一起使用的命令列表。

运行 pip help 命令验证安装。 如果收到错误,请重复安装过程。

第 4 步:将 Pip 添加到 Windows 环境变量 要从任何位置 运行 PIP,您需要将其添加到 Windows 环境变量以避免出现“not on PATH”错误。为此,请按照下列步骤操作:

通过在控制面板中搜索打开系统和安全 window。 导航到系统设置。 导航到 Windows 中的系统设置。 然后,select高级系统设置。

打开环境变量,双击系统变量中的Path变量

接下来,select新建并添加您安装 PIP 的目录。 单击“确定”保存更改。 第 5 步:配置 Windows中PIP配置文件为%HOME%\pip\pip.ini.

还有一个遗留的每用户配置文件。该文件位于 %APPDATA%\pip\pip.ini.

您可以使用环境变量为此配置文件设置自定义路径位置 PIP_CONFIG_FILE。