【问题标题】:Pip doesn't work, says it cannot build wheelsPip 不工作,说它不能造轮子
【发布时间】:2021-01-19 16:32:12
【问题描述】:

我在网上寻找解决方案,但没有找到。

我有一台新电脑,这是我拥有的第一台桌面,我需要为高中项目安装 python 和 pip 以及所有这些东西,但是在安装 PyTorch 和其他我需要的软件包时,我遇到了这个错误:

C:\Users\Owlsoul>pip3 install torch
Defaulting to user installation because normal site-packages is not writeable
Collecting torch
  Using cached torch-0.1.2.post2.tar.gz (128 kB)
Collecting pyyaml
  Using cached PyYAML-5.3.1.tar.gz (269 kB)
Building wheels for collected packages: torch, pyyaml
  Building wheel for torch (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\program files\inkscape\bin\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-hw6a8m3j\\torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-hw6a8m3j\\torch\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Owlsoul\AppData\Local\Temp\pip-wheel-kmaghkld'
       cwd: C:\Users\Owlsoul\AppData\Local\Temp\pip-install-hw6a8m3j\torch\
  Complete output (30 lines):
  running bdist_wheel
  running build
  running build_deps
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\Owlsoul\AppData\Local\Temp\pip-install-hw6a8m3j\torch\setup.py", line 225, in <module>
      setup(name="torch", version="0.1.2.post2",
    File "C:\Users\Owlsoul\.local\lib\python3.8\site-packages\setuptools\__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "C:\program files\inkscape\lib\python3.8\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "C:\program files\inkscape\lib\python3.8\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "C:\program files\inkscape\lib\python3.8\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\Owlsoul\.local\lib\python3.8\site-packages\wheel\bdist_wheel.py", line 290, in run
      self.run_command('build')
    File "C:\program files\inkscape\lib\python3.8\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\program files\inkscape\lib\python3.8\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\program files\inkscape\lib\python3.8\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "C:\program files\inkscape\lib\python3.8\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\program files\inkscape\lib\python3.8\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\Owlsoul\AppData\Local\Temp\pip-install-hw6a8m3j\torch\setup.py", line 51, in run
      from tools.nnwrap import generate_wrappers as generate_nn_wrappers
  ModuleNotFoundError: No module named 'tools.nnwrap'
  ----------------------------------------
  ERROR: Failed building wheel for torch
  Running setup.py clean for torch
  ERROR: Command errored out with exit status 1:
   command: 'c:\program files\inkscape\bin\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-hw6a8m3j\\torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-hw6a8m3j\\torch\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
       cwd: C:\Users\Owlsoul\AppData\Local\Temp\pip-install-hw6a8m3j\torch
  Complete output (2 lines):
  running clean
  error: [Errno 2] No such file or directory: '.gitignore'
  ----------------------------------------
  ERROR: Failed cleaning build dir for torch
  Building wheel for pyyaml (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\program files\inkscape\bin\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-hw6a8m3j\\pyyaml\\setup.py'"'"'; __file__='"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-hw6a8m3j\\pyyaml\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Owlsoul\AppData\Local\Temp\pip-wheel-nztx1z7u'
       cwd: C:\Users\Owlsoul\AppData\Local\Temp\pip-install-hw6a8m3j\pyyaml\
  Complete output (59 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.mingw-3.8
  creating build\lib.mingw-3.8\yaml
  copying lib3\yaml\composer.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\constructor.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\cyaml.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\dumper.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\emitter.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\error.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\events.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\loader.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\nodes.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\parser.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\reader.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\representer.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\resolver.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\scanner.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\serializer.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\tokens.py -> build\lib.mingw-3.8\yaml
  copying lib3\yaml\__init__.py -> build\lib.mingw-3.8\yaml
  running build_ext
  'gcc' is not recognized as an internal or external command,
  operable program or batch file.
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\Owlsoul\AppData\Local\Temp\pip-install-hw6a8m3j\pyyaml\setup.py", line 291, in <module>
      setup(
    File "C:\program files\inkscape\lib\python3.8\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "C:\program files\inkscape\lib\python3.8\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "C:\program files\inkscape\lib\python3.8\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\Owlsoul\.local\lib\python3.8\site-packages\wheel\bdist_wheel.py", line 290, in run
      self.run_command('build')
    File "C:\program files\inkscape\lib\python3.8\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\program files\inkscape\lib\python3.8\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\program files\inkscape\lib\python3.8\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "C:\program files\inkscape\lib\python3.8\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\program files\inkscape\lib\python3.8\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\Owlsoul\AppData\Local\Temp\pip-install-hw6a8m3j\pyyaml\setup.py", line 185, in run
      _build_ext.run(self)
    File "C:\program files\inkscape\lib\python3.8\distutils\command\build_ext.py", line 307, in run
      self.compiler = new_compiler(compiler=self.compiler,
    File "C:\program files\inkscape\lib\python3.8\distutils\ccompiler.py", line 1034, in new_compiler
      return klass(None, dry_run, force)
    File "C:\program files\inkscape\lib\python3.8\distutils\cygwinccompiler.py", line 310, in __init__
      CygwinCCompiler.__init__ (self, verbose, dry_run, force)
    File "C:\program files\inkscape\lib\python3.8\distutils\cygwinccompiler.py", line 127, in __init__
      if self.ld_version >= "2.10.90":
  TypeError: '>=' not supported between instances of 'NoneType' and 'str'
  ----------------------------------------
  ERROR: Failed building wheel for pyyaml
  Running setup.py clean for pyyaml
Failed to build torch pyyaml
Installing collected packages: pyyaml, torch
    Running setup.py install for pyyaml ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\program files\inkscape\bin\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-hw6a8m3j\\pyyaml\\setup.py'"'"'; __file__='"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-hw6a8m3j\\pyyaml\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Owlsoul\AppData\Local\Temp\pip-record-v7hld7x2\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Owlsoul\.local\include\python3.8\pyyaml'
         cwd: C:\Users\Owlsoul\AppData\Local\Temp\pip-install-hw6a8m3j\pyyaml\
    Complete output (61 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.mingw-3.8
    creating build\lib.mingw-3.8\yaml
    copying lib3\yaml\composer.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\constructor.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\cyaml.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\dumper.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\emitter.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\error.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\events.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\loader.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\nodes.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\parser.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\reader.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\representer.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\resolver.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\scanner.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\serializer.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\tokens.py -> build\lib.mingw-3.8\yaml
    copying lib3\yaml\__init__.py -> build\lib.mingw-3.8\yaml
    running build_ext
    'gcc' is not recognized as an internal or external command,
    operable program or batch file.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Owlsoul\AppData\Local\Temp\pip-install-hw6a8m3j\pyyaml\setup.py", line 291, in <module>
        setup(
      File "C:\program files\inkscape\lib\python3.8\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\program files\inkscape\lib\python3.8\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\program files\inkscape\lib\python3.8\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\Owlsoul\.local\lib\python3.8\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\program files\inkscape\lib\python3.8\distutils\command\install.py", line 546, in run
        self.run_command('build')
      File "C:\program files\inkscape\lib\python3.8\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\program files\inkscape\lib\python3.8\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\program files\inkscape\lib\python3.8\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "C:\program files\inkscape\lib\python3.8\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\program files\inkscape\lib\python3.8\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\Owlsoul\AppData\Local\Temp\pip-install-hw6a8m3j\pyyaml\setup.py", line 185, in run
        _build_ext.run(self)
      File "C:\program files\inkscape\lib\python3.8\distutils\command\build_ext.py", line 307, in run
        self.compiler = new_compiler(compiler=self.compiler,
      File "C:\program files\inkscape\lib\python3.8\distutils\ccompiler.py", line 1034, in new_compiler
        return klass(None, dry_run, force)
      File "C:\program files\inkscape\lib\python3.8\distutils\cygwinccompiler.py", line 310, in __init__
        CygwinCCompiler.__init__ (self, verbose, dry_run, force)
      File "C:\program files\inkscape\lib\python3.8\distutils\cygwinccompiler.py", line 127, in __init__
        if self.ld_version >= "2.10.90":
    TypeError: '>=' not supported between instances of 'NoneType' and 'str'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files\inkscape\bin\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-hw6a8m3j\\pyyaml\\setup.py'"'"'; __file__='"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-hw6a8m3j\\pyyaml\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Owlsoul\AppData\Local\Temp\pip-record-v7hld7x2\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Owlsoul\.local\include\python3.8\pyyaml' Check the logs for full command output.

提前感谢您的帮助。

听从你的建议后,又弹出一个新的错误:


C:\Users\Owlsoul>pip install torch
Defaulting to user installation because normal site-packages is not writeable
Collecting torch
  Using cached torch-0.1.2.post2.tar.gz (128 kB)
Requirement already satisfied: pyyaml in c:\users\owlsoul\appdata\roaming\python\python38\site-packages (from torch) (5.3.1)
Building wheels for collected packages: torch
  Building wheel for torch (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\program files (x86)\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-jio16_76\\torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-jio16_76\\torch\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Owlsoul\AppData\Local\Temp\pip-wheel-iuye_5re'
       cwd: C:\Users\Owlsoul\AppData\Local\Temp\pip-install-jio16_76\torch\
  Complete output (30 lines):
  running bdist_wheel
  running build
  running build_deps
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\Owlsoul\AppData\Local\Temp\pip-install-jio16_76\torch\setup.py", line 225, in <module>
      setup(name="torch", version="0.1.2.post2",
    File "c:\program files (x86)\python38-32\lib\site-packages\setuptools\__init__.py", line 144, in setup
      return distutils.core.setup(**attrs)
    File "c:\program files (x86)\python38-32\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\Owlsoul\AppData\Roaming\Python\Python38\site-packages\wheel\bdist_wheel.py", line 290, in run
      self.run_command('build')
    File "c:\program files (x86)\python38-32\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "c:\program files (x86)\python38-32\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "c:\program files (x86)\python38-32\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\Owlsoul\AppData\Local\Temp\pip-install-jio16_76\torch\setup.py", line 51, in run
      from tools.nnwrap import generate_wrappers as generate_nn_wrappers
  ModuleNotFoundError: No module named 'tools.nnwrap'
  ----------------------------------------
  ERROR: Failed building wheel for torch
  Running setup.py clean for torch
  ERROR: Command errored out with exit status 1:
   command: 'c:\program files (x86)\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-jio16_76\\torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-jio16_76\\torch\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
       cwd: C:\Users\Owlsoul\AppData\Local\Temp\pip-install-jio16_76\torch
  Complete output (2 lines):
  running clean
  error: [Errno 2] No such file or directory: '.gitignore'
  ----------------------------------------
  ERROR: Failed cleaning build dir for torch
Failed to build torch
Installing collected packages: torch
    Running setup.py install for torch ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\program files (x86)\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-jio16_76\\torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-jio16_76\\torch\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Owlsoul\AppData\Local\Temp\pip-record-z9idl5pc\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Owlsoul\AppData\Roaming\Python\Python38\Include\torch'
         cwd: C:\Users\Owlsoul\AppData\Local\Temp\pip-install-jio16_76\torch\
    Complete output (23 lines):
    running install
    running build_deps
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Owlsoul\AppData\Local\Temp\pip-install-jio16_76\torch\setup.py", line 225, in <module>
        setup(name="torch", version="0.1.2.post2",
      File "c:\program files (x86)\python38-32\lib\site-packages\setuptools\__init__.py", line 144, in setup
        return distutils.core.setup(**attrs)
      File "c:\program files (x86)\python38-32\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\Owlsoul\AppData\Local\Temp\pip-install-jio16_76\torch\setup.py", line 99, in run
        self.run_command('build_deps')
      File "c:\program files (x86)\python38-32\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\Owlsoul\AppData\Local\Temp\pip-install-jio16_76\torch\setup.py", line 51, in run
        from tools.nnwrap import generate_wrappers as generate_nn_wrappers
    ModuleNotFoundError: No module named 'tools.nnwrap'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files (x86)\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-jio16_76\\torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\Owlsoul\\AppData\\Local\\Temp\\pip-install-jio16_76\\torch\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Owlsoul\AppData\Local\Temp\pip-record-z9idl5pc\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Owlsoul\AppData\Roaming\Python\Python38\Include\torch' Check the logs for full command output.

【问题讨论】:

  • 一定有更多的错误行。发布完整的堆栈跟踪。
  • 好的,我马上做
  • 你用的是python x32还是x64?
  • 我安装了 x64
  • 你的系统也是x64的?

标签: python windows pip


【解决方案1】:

请注意,您的错误是由c:\program files\inkscape\bin\python.exe 引起的,几乎可以肯定完全是错误的 python 可执行文件,因为这不是 python 自身安装的位置。

卸载你安装的任何东西,然后从https://www.python.org/downloads/windows/ 获取最新的安装程序,运行它(使用管理员权限,因为希望你记得确保你自己的帐户设置为正常帐户类型并且不是管理员帐户,出于明显的安全原因),然后在完成安装后,请确保更新您的 PATH:

  • 运行“高级系统设置”
  • 点击“环境变量”按钮
  • 双击“系统变量”部分中的PATH 条目
  • 确认C:\Program Files\Python38\C:\Program Files\Python38\Scripts\ 都在其中。如果没有,请添加它们。 (当然也可以是您自定义安装它们的任何位置)。
  • 可能需要:还要检查您的路径中是否有 Inkscape 条目。如果有,请使用“上移”/“下移”按钮确保 Python 条目列在 Inkscape 条目的上方。

然后您可以使用管理员权限启动 cmd/powershell/etc(如果您已经打开了一个,请关闭它并启动一个新的以使更新的 PATH 生效),然后使用pip(不是pip3 ) 全局安装包。

也就是说,对于您几乎总是希望使用 python 的“virtualenv”概念的项目,在 https://docs.python.org/3/tutorial/venv.html 上进行了解释,它允许您在本地安装依赖项,这意味着如果一个项目需要 Django 2.10 而另一个需要 Djangoo 3.0,他们每个人都安装在自己的虚拟环境中,而不是引起全局依赖冲突。

【讨论】:

  • 好的,非常感谢,我目前正在再次安装 python 并更改了路径,所以我认为它应该可以工作
  • 还要确保您的 Python 位置高于 PATH 中的 c:\program files\inkscape\bin 条目。 PATH 列表是按顺序检查的,因此如果您的 Python 条目位于最后,Windows 仍会首先找到 Inkscape 的 Python 版本并尝试运行该版本而不是正确的版本。
  • 我完全卸载了inkscape,因为我不会经常使用它
  • 除非你说出错误是什么,否则我无法处理这些信息。如果您使用新错误更新您的帖子,我(和其他人)可以解决它。
  • 我正在编辑原始消息以包含新错误。 我不知道它是否能很好地转化为我的写作,但我非常感谢您的帮助
【解决方案2】:

最后,我最终使用了 anaconda,它成功了。非常感谢,但是设置这些东西会让我发疯,而且我可能没有能力理解很多说明......

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-20
    • 2016-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-31
    • 1970-01-01
    • 2017-02-28
    相关资源
    最近更新 更多