解决EasyInstallDeprecationWarning: easy_install command is deprecated.

发布于:2025-08-20 ⋅ 阅读:(17) ⋅ 点赞:(0)

编译Livox Detection V2.0代码环境时报错

/home/xxx/.local/lib/python3.8/site-packages/setuptools/command/develop.py:40: 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.
        ********************************************************************************

!!
  easy_install.initialize_options(self)
/home/ssa/.local/lib/python3.8/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()
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: '/usr/lib/python3.8/site-packages/test-easy-install-246597.write-test'

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

    /usr/lib/python3.8/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.

分析

  • Python 包安装过程中的两个主要问题:
    ** deprecation 警告 **:setup.py install 和 easy_install 命令已被弃用,官方推荐使用更现代的工具如 pypa/build、pypa/installer 等。
  • 权限问题:你没有权限写入 /usr/lib/python3.8/site-packages/ 目录,这是系统级的 Python 库目录。

解决:使用虚拟环境(更推荐的最佳实践)


# 创建虚拟环境
python -m venv myenv

# 激活虚拟环境
# Linux/Mac:
source myenv/bin/activate
# Windows:
myenv\Scripts\activate

# 在虚拟环境中安装,无需管理员权限
pip install <包名>

在这里插入图片描述


网站公告

今日签到

点亮在社区的每一天
去签到