python 3.6安装和lib64 [英] python 3.6 installation and lib64
问题描述
我正在尝试在openSUSE 42.2上从源代码安装新的Python(3.6,仅在几周前发布)。一切
I'm trying to install the new Python (3.6, released just a few weeks back) from source on openSUSE 42.2. 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'
现在,模块在那里,它安装在$ PREFIX / lib64 / python3.6 / lib-dynload / readline.cpython-36m-x86_64-linux-gnu.so下。
只有解释器不在那儿(它完全忽略了lib64,我用-vv检查过)。
Now, the module is there, it is installed under $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下的所有内容,尤其是lib-dynload下的模块。
Update: To be clear, this does not only affect readline but everything under lib64, most notably the modules under lib-dynload.
这似乎是一个已知问题,请参见 Python bugtracker 。这是一个相当漫长的交换,结尾是
This appears to be a known issue, see the Python bugtracker. It's a fairly lengthy exchange ending in
在这里需要做什么达成一致?我想在它达到10岁生日之前将其变成3.5:)
Is there agreement on what needs doing here? I'd like to see this into 3.5 before it reaches its 10th birthday :)
这让我有些困惑。这个应该解决吗?
我不记得曾经遇到过这个问题,所以我想知道它是否是3.6回归。
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.
很显然,任何修复方法都是最受欢迎的。
And obviously, any fix would be most welcome.
更新:目前,我可以通过将lib64下的所有内容符号链接到lib来解决此问题。显然,这不是理想的解决方案。至少,它首先达到了引入lib64(能够并排拥有32和64位版本)的目的。
我更喜欢配置文件中的内容。
Update: for the time being I can work around the issue by symlinking everything under lib64 into 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. I'd much prefer something in a config file.
推荐答案
opensuse开发:语言:python:Factory
python3包为此提供了补丁。
Spec文件通常是一个很好的起点。
The opensuse devel:languages:python:Factory
python3 package has patches for that.
Spec files are usually a good starting point.
注意:安装
步骤将安装 python3
在 / usr / local / bin
中。将其更改为 altinstall
可以避免对系统范围的 python3
产生阴影。
Note: the install
step would install a python3
in /usr/local/bin
. Changing that to altinstall
avoids shadowing the system-wide python3
.
创建一个 downloads
变量,该变量指向所有下载文件的目录( Python来源和工厂补丁)将被保存
Create a downloads
variable pointing to a directory where all downloaded files (python source and factory patches) will be saved
export downloads=/usr/local/build/downloads
在用户可写目录中:
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*
适用于python3.7
For 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
对于python 3.8
For 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
这篇关于python 3.6安装和lib64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!