简体   繁体   English

python 3.6安装和lib64

[英]python 3.6 installation and lib64

I'm trying to install the new Python (3.6, released just a few weeks back) from source on openSUSE 42.2.我正在尝试在 openSUSE 42.2 上从源代码安装新的 Python(3.6,几周前发布)。 Everything一切

./configure --prefix /home/paul/2017 --enable-optimizations
make
make install

appears to work just fine, but when I call the shiny new interpreter I get this error:似乎工作得很好,但是当我调用闪亮的新解释器时,我收到此错误:

Python 3.6.0 (default, Jan  9 2017, 22:01:27)                                                                                                                                     
[GCC 4.8.5] on linux                                                                                                                                                              
Type "help", "copyright", "credits" or "license" for more information.                                                                                                            
Traceback (most recent call last):
  File "/home/paul/.pythonrc", line 7, in <module>
    import readline
ModuleNotFoundError: No module named 'readline'

Now, the module is there, it is installed under $PREFIX/lib64/python3.6/lib-dynload/readline.cpython-36m-x86_64-linux-gnu.so.现在,模块就在那里,它安装在 $PREFIX/lib64/python3.6/lib-dynload/readline.cpython-36m-x86_64-linux-gnu.so 下。 Only the interpreter is not looking there (it is completely ignoring lib64, I checked with -vv).只有解释器不在那里(它完全忽略了 lib64,我用 -vv 进行了检查)。

Update: To be clear, this does not only affect readline but everything under lib64, most notably the modules under lib-dynload.更新:需要明确的是,这不仅会影响 readline,还会影响 lib64 下的所有内容,尤其是 lib-dynload 下的模块。

This appears to be a known issue, see the Python bugtracker .这似乎是一个已知问题,请参阅Python bugtracker It's a fairly lengthy exchange ending in这是一个相当漫长的交流结束于

Is there agreement on what needs doing here?是否就需要在这里做什么达成一致? I'd like to see this into 3.5 before it reaches its 10th birthday :)我想在它 10 岁生日之前看到它变成 3.5 :)

This leaves me a bit confused.这让我有点困惑。 Is this supposed to be resolved?这是应该解决的吗? I do not remember ever running into this issue before, so I wonder if it is a 3.6 regression.我不记得以前遇到过这个问题,所以我想知道它是否是 3.6 回归。

And obviously, any fix would be most welcome.显然,任何修复都是最受欢迎的。

Update: for the time being I can work around the issue by symlinking everything under lib64 into lib.更新:目前我可以通过将 lib64 下的所有内容符号链接到 lib 来解决这个问题。 Obviously, that is not an ideal solution;显然,这不是一个理想的解决方案。 at the very least it defeats the purpose of introducing lib64 (being able to have 32 and 64 bit versions side-by-side) in the first place.至少,它首先违背了引入 lib64(能够并排拥有 32 位和 64 位版本)的目的。 I'd much prefer something in a config file.我更喜欢配置文件中的内容。

The opensuse openSUSE:Factory python3x has patches for that. opensuse openSUSE:Factory python3x有补丁。

Links: Python 3.6 Python 3.8 Python 3.9链接: Python 3.6 Python 3.8 Python 3.9

Spec files are usually a good starting point.规范文件通常是一个很好的起点。

Note: the install step would install a python3 in /usr/local/bin .注意: install步骤将在/usr/local/bin安装python3 Changing that to altinstall avoids shadowing the system-wide python3 .将其更改为altinstall可避免隐藏系统范围的python3

Install安装

Create a downloads variable pointing to a directory where all downloaded files ( python source and factory patches ) will be saved创建一个指向所有下载文件( python 源工厂补丁)的目录的downloads变量

export downloads=/usr/local/build/downloads

In a user writable directory:在用户可写目录中:

tar --no-same-owner -xvf $downloads/Python-3.6.4.tar.xz
cd Python-3.6.4

patch -p1 < $downloads/python-3.6.0-multilib-new.patch
patch -p0  < $downloads/python-3.3.0b1-localpath.patch
patch -p0 < $downloads/python-3.3.0b1-curses-panel.patch

# mind this step, otherwise
# none of the modules in `lib-dynload` could be imported !
autoreconf -i

mkdir build; cd $_
../configure --enable-optimizations --enable-ipv6 \
             --with-fpectl --enable-shared --with-system-ffi \
             --with-system-expat --enable-loadable-sqlite-extensions
make -j $(nproc)
# altinstall, not install (see above)
sudo make altinstall

Uninstall卸载

To get rid of the installed files:要删除已安装的文件:

sudo rm -rf /usr/local/lib64/python3.6/
sudo rm -f /usr/local/lib64/libpython3.6m*
sudo rm -f /usr/local/lib64/libpython3.so
sudo rm -f /usr/local/lib64/pkgconfig/python-3.6*
sudo rm -f /usr/local/bin/python-3.6*

For python3.7对于python3.7

tar --no-same-owner -xvf $downloads/Python-3.7.3.tar.xz
cd Python-3.7.3
patch -p1 < $downloads/python-3.7.3-python-3.6.0-multilib.patch
patch -p1 < $downloads/python-3.7.3-distutils-reproducible-compile.patch
patch -p0 < $downloads/python-3.7.3-python-3.3.0b1-localpath.patch
patch -p0 < $downloads/python-3.7.3-00251-change-user-install-location.patch

# do not forget !
autoreconf -i

mkdir build; cd $_
../configure --enable-optimizations --enable-ipv6 --enable-shared --with-system-ffi --with-system-expat --enable-loadable-sqlite-extensions

make -j $(nproc)

sudo make altinstall

For python 3.8对于python 3.8

tar --no-same-owner -xvf $downloads/Python-3.8.1.tar.xz
cd Python-3.8.1/
patch -p1 < $downloads/python-3.8.1-F00102-lib64.patch
patch -p1 < $downloads/python-3.8.1-F00251-change-user-install-location.patch
patch -p1 < $downloads/python-3.8.1-SUSE-FEDORA-multilib.patch
patch -p1 < $downloads/python-3.8.1-distutils-reproducible-compile.patch
patch -p1 < $downloads/python-3.8.1-python-3.3.0b1-localpath.patch

# do not forget !
autoreconf -i

mkdir build; cd $_
../configure --enable-optimizations --enable-ipv6 --enable-shared \
             --with-system-ffi --with-system-expat \
             --enable-loadable-sqlite-extensions
make -j $(nproc)
# altinstall, not install (see above)
sudo make altinstall

Ok, I found a solution: If one configures with the --enable_shared option the problem somehow goes away.好的,我找到了一个解决方案:如果使用--enable_shared选项进行配置,问题就会以某种方式消失。 Good enough for me.对我来说已经足够好了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM