pycharm 在paycharm中安装任何库时出错

j2cgzkjk  于 2023-02-04  发布在  PyCharm
关注(0)|答案(1)|浏览(236)
  • 调用任意库的“pip install“命令后,出现错误:*
ERROR: Command errored out with exit status 2:
   command: 'c:\users\roman\appdata\local\programs\python\python38\python.exe' 'c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip' install -
-ignore-installed --no-user --prefix 'C:\Users\roman\AppData\Local\Temp\pip-build-env-2tu6fau4\overlay' --no-warn-script-location --no-binary :none: --only-binary :no
ne: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel
       cwd: None
  Complete output (24 lines):
  Collecting setuptools>=40.8.0
    Using cached setuptools-67.0.0-py3-none-any.whl (1.1 MB)
  Collecting wheel
    Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
  Installing collected packages: setuptools, wheel
  ERROR: Exception:
  Traceback (most recent call last):
    File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\cli\base_command.py", line 216, in _main
      status = self.run(options, args)
    File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\cli\req_command.py", line 182, in wrapper
      return func(self, options, args)
    File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\commands\install.py", line 412, in run
      installed = install_given_reqs(
    File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\req\__init__.py", line 82, in install_given_reqs
      requirement.install(
    File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\req\req_install.py", line 778, in install
      scheme = get_scheme(
    File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\locations.py", line 185, in get_scheme
      scheme = distutils_scheme(
    File "c:\users\roman\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\locations.py", line 118, in distutils_scheme
      assert not (home and prefix), "home={} prefix={}".format(home, prefix)
  AssertionError: home=C:\Users\roman\AppData\Local\Temp\pip-target-tdo35poo prefix=C:\Users\roman\AppData\Local\Temp\pip-build-env-2tu6fau4\overlay
  WARNING: You are using pip version 20.2.1; however, version 22.3.1 is available.
  You should consider upgrading via the 'c:\users\roman\appdata\local\programs\python\python38\python.exe -m pip install --upgrade pip' command.
  ----------------------------------------
ERROR: Command errored out with exit status 2: 'c:\users\roman\appdata\local\programs\python\python38\python.exe' 'c:\users\roman\appdata\local\programs\python\python
38\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\roman\AppData\Local\Temp\pip-build-env-2tu6fau4\overlay' --no-warn-script-location -
-no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel Check the logs for full command output.`

重要的细微差别:

1.我在paycharm没有模块的新项目。
1.纯Python 3.9

  1. pip(Python 3.8)。
    1.我不是Windows 10系统中的管理员。
    1.我正确地将Python 3.9添加到了系统路径中。
    1.通过解释器设置安装库也会出现相同的错误
    1.我重新安装了python和paycharm
    1.我试着写pip3--no-user
ct2axkht

ct2axkht1#

在谷歌上搜索错误assert not (home and prefix)时,我们可以找到this pypa/pip issue,有人通过确保他们的pip.conf没有target行来解决这个问题。
你应该确保你的pip配置文件中没有多余的cruft和/或没有设置PIP_TARGET环境变量或类似的东西。

相关问题