如何修复 Windows 中未安装 scons 的问题?

问题描述 投票:0回答:1

我在c++中使用godot,它原生的c++需要安装scons。我正常安装了scons。但这引起了一个问题:

C:\Users\Admin\AppData\Roaming\Python\Python312\site-packages\setuptools\__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.
        ********************************************************************************

!!
  dist.fetch_build_eggs(dist.setup_requires)
running install
C:\Users\Admin\AppData\Roaming\Python\Python312\site-packages\setuptools\_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
C:\Users\Admin\AppData\Roaming\Python\Python312\site-packages\setuptools\_distutils\cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
  self.initialize_options()
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\\Python312\\Lib\\site-packages\\test-easy-install-1112.write-test'

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

    C:\Program Files\Python312\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.pypa.io/en/latest/deprecated/easy_install.html

Please make the appropriate changes for your system and try again.
I think this is error is in the file. So i use pip :"pip install scons". It run normally and i type "scons --version".But it say...
'scons' is not recognized as an internal or external command,
operable program or batch file.
I was search the internet and do like it. But nothing happend.

这是我的 scons 文件:

The scons file:

这就是错误问题:

The problem

还有这个:

The scons not be installed

所以我通过“pip uninstall scons”删除了scons。我再次下载,但没有任何进展。 你能帮我吗?

系列,因为我是堆栈溢出的新手

python c++ pip godot scons
1个回答
0
投票

尝试:

python -nSCons 

安装 SCons(和/或任何 python 包恕我直言)的一个非常好的方法是将它们安装在 virtualenv 中。 您可以在我们的食谱中找到说明:https://scons-cookbook.readthedocs.io/en/latest/#setting-up-a-python-virtualenv-for-scons

C:\Users\user>cd Work
C:\Users\user\Work>py -m venv myvenv
C:\Users\user\Work>.\myvenv\Scripts\activate
(myvenv) C:\Users\user\Work>pip list --outdated
Package    Version Latest Type
---------- ------- ------ -----
pip        20.2.3  22.0.4 wheel
setuptools 49.2.1  62.1.0 wheel
WARNING: You are using pip version 20.2.3; however, version 22.0.4 is available.
You should consider upgrading via the 'C:\Users\user\Work\myvenv\Scripts\python.exe -m pip install --upgrade pip' command.
(myvenv) C:\Users\user\Work\myvenv\Scripts\python.exe -m pip install --upgrade pip setuptools scons
Collecting pip
  Downloading pip-22.0.4-py3-none-any.whl (2.1 MB)
Collecting setuptools
  Downloading setuptools-62.1.0-py3-none-any.whl (1.1 MB)
Collecting scons
  Downloading SCons-4.3.0-py3-none-any.whl (4.2 MB)
Installing collected packages: pip, setuptools, scons
  Attempting uninstall: pip
    Found existing installation: pip 20.2.3
    Uninstalling pip-20.2.3:
      Successfully uninstalled pip-20.2.3
  Attempting uninstall: setuptools
    Found existing installation: setuptools 49.2.1
    Uninstalling setuptools-49.2.1:
      Successfully uninstalled setuptools-49.2.1
Successfully installed pip-22.0.4 scons-4.3.0 setuptools-62.1.0
(myvenv) C:\Users\user\Work>scons --version
SCons by Steven Knight et al.:
        SCons: v4.3.0.559790274f66fa55251f5754de34820a29c7327a, Tue, 16 Nov 2021 19:09:21 +0000, by bdeegan on octodog
        SCons path: ['c:\\users\\user\\work\\myvenv\\lib\\site-packages\\SCons']
Copyright (c) 2001 - 2021 The SCons Foundation
(myvenv) C:\Users\user\Work> deactivate
C:\Users\user\Work>
© www.soinside.com 2019 - 2024. All rights reserved.