python3 setup.py 安装失败(RHEL 8)

标签 python python-3.x python-3.6 setuptools distutils

问题:

#python3 setup.py install

失败

环境:RHEL 8 UBI 容器


我有一个如下所示的 setup.py:(对此 setup.py 的任何指针或更新将不胜感激)

import setuptools

print('python/setup.py')

setuptools.setup(
      name="process_data",
      version="1.0",
      description="desc",
      author="FirstName LastName",
      author_email="<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6a0e1f0e0f2a0b08030e0f19440b08030e0f" rel="noreferrer noopener nofollow">[email protected]</a>",
      url="https://some.com",
      packages=setuptools.find_packages(),
)

我有一个像这样的目录结构(每个目录中都有 <some>.py 以及 __init__.py ):

python/
 setup.py
 <dir>/__init__.py
 <dir>/__init__.py
 <dir4>/__init__.py
 <dir4>/<sub-dir1>/__init__.py
 <dir4>/<sub-dir1>/<sub-dir>__init__.py

我希望每个目录中的代码都成为模块包的一部分,以便我可以导入,无论嵌套有多深。


我正在这样做:

#cd python
#python3 setup.py install

我收到此错误:

python/setup.py
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:

/usr/local/lib/python3.6/site-packages/test-easy-install-1625.write-test

    [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/test-easy-install-1625.write-test'

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

    /usr/local/lib/python3.6/site-packages/

This directory does not currently exist.  Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).

问题:

这是从哪里来的: test-easy-install-1625.write-test ? (很困惑这是什么)

在我的系统上,这个目录确实不存在(为什么 python3 setup.py install 会查找那里?是什么告诉它查找那里?): /usr/local/lib/python3.6

我的setup.py里什么都没有表示看那里。


我看了一遍,看起来我的/site-packages/目录就在这里(当我运行 pip 时,安装了其他模块)

`/usr/local/lib64/python3.6/site-packages/`

如何解决这个问题?

谢谢,我非常需要立即开始工作。我一直在 Windows 上工作,并且 >python setup.py install只是在那里工作。

我应该设置任何环境变量吗?

我只是安装了 python:dnf -y install python36就是这样。 (任何 RHEL 8 软件包存储库中都提供用于安装的最新版本)。

最佳答案

我遇到了同样的错误,我可以通过创建符号链接(symbolic link)来修复它。我接受其他人也许能够提供更优雅的解决方案,并且我对此表示欢迎。

sudo mkdir /usr/local/lib/python3.6
sudo ln -s /usr/lib/python3.6/site-packages /usr/local/lib/python3.6/

关于python3 setup.py 安装失败(RHEL 8),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59657597/

相关文章:

anaconda - ImportError: libstdc++.so.6: 找不到版本 `CXXABI_1.3.9' (...需要)

Python Websocket : infinite lock on client recv

python - 初学者 Python 练习?

python - 同步数据库时我应该使用什么密码?

python - ib_insync 减少日志记录的冗长

python - 从 MatPlotLib Canvas 获取二进制图像数据?

linux - 合并多个具有相似名称的 csv 文件

python - 使用 python 将比特流保存到文件

python - 使用 ipython 在 pycharm 中获得真正的代码完成

python - 在 Enthought Canopy 旁边安装 python3