使用新的安装(我在另一个分区中有Ubuntu 20)搬到Ubuntu 22,而最后一件我需要使用它来使Pyenv运行正常。
尝试 pyenv install x.xx.x
在此错误中失败:
错误:未编译Python SSL扩展名。缺少openssl lib?
我“尝试尝试”官方文档提出:
我说“尝试尝试”,因为我不明白我要做什么。
他们给出了这些命令:
CPPFLAGS="-I<openssl install prefix>/include" \
LDFLAGS="-L<openssl install prefix>/lib" \
pyenv install -v <python version>
但是我不知道“ OpenSSL安装前缀”是什么意思。我以为是openssl安装dir,所以我做到了:
openssl version -d
OPENSSLDIR: "/home/linuxbrew/.linuxbrew/etc/[email protected]"
即使我在此文件夹中看到arent'任何 incept
或 lib
subfolders,我还是通过这样做尝试了:
CPPFLAGS="-I/home/linuxbrew/.linuxbrew/etc/[email protected]/include" \
LDFLAGS="-L/home/linuxbrew/.linuxbrew/etc/[email protected]/lib" \
pyenv install -v 3.10.0
最终获得了相同的错误消息。
要说,我尝试了许多在其他地方发现的其他东西,但没有任何效果,但是为了简单起见,我坚持官方的迹象。
如果您遇到了同样的问题,而解决方案来自除这些命令以外的其他地方,请分享!
非常感谢:)
更新
&lt; openssl install install prefix&gt;
仅引用基本路径或基本文件夹,只是该自制者决定发明一个新名称,因为...好吧,我猜是一些非常重要的原因。
仅通过替换&lt; openssl install precix&gt;
$(brew -prefix openssl)
来解决此部分。
请参阅我对下面问题的回答,以了解它如何对我有效,但是根据我一直在看到和尝试的所有不同解决方案来判断,每种情况可能都需要不同的解决方案。祝你好运!
Moving to Ubuntu 22 with a fresh install (I have Ubuntu 20 in another partition) and the last piece I need to use it for working it to have pyenv running fine.
When trying to pyenv install x.xx.x
it fails with this error:
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
I "tried to try" what the official docs proposes:
I said "tried to try" because I don't understand what I have to do.
They give these commands:
CPPFLAGS="-I<openssl install prefix>/include" \
LDFLAGS="-L<openssl install prefix>/lib" \
pyenv install -v <python version>
But I don't know what the "openssl install prefix" means. I assumed it's the openssl installation dir, so I did:
openssl version -d
OPENSSLDIR: "/home/linuxbrew/.linuxbrew/etc/[email protected]"
Even though I see that in this folder there arent' any include
or lib
subfolders, I tried it anyway by doing this:
CPPFLAGS="-I/home/linuxbrew/.linuxbrew/etc/[email protected]/include" \
LDFLAGS="-L/home/linuxbrew/.linuxbrew/etc/[email protected]/lib" \
pyenv install -v 3.10.0
Which ended up with the same error message.
Gotta say, I tried a lot of other stuff that I found in other places and nothing worked, but for the sake of simplicity I'm sticking with the official indications.
If you faced the same problem and the solution came from somewhere else than these commands, please share!
Many thanks :)
Update
<openssl install prefix>
just refers to the base path or base folder, just that Homebrew decided to invent a new name because... well, some very important reason I guess.
This part gets solved by just replacing <openssl install prefix>
by $(brew --prefix openssl)
.
See my own answer to the question below to see how it worked for me, but judging for all the different solutions that I've been seeing and trying, every case might need a different solution. Good luck!
发布评论
评论(12)
Ubuntu 16.04。旗帜对我不起作用。配置LDCONFIG帮助:
可能需要从来源安装OpenSSL:
Ubuntu 16.04. The flags didn't work for me. Configuring ldconfig helped:
May need to install openssl from source:
只是为了创建答案作为选项。问题很可能是
python3.10
的开发标题尚未在python3-dev
中。安装python3.10-dev
,您应该很好。Just to create an answer as an option. The problem is most likely that the dev headers for
python3.10
is not yet inpython3-dev
. Installpython3.10-dev
and you should be good to go.在尝试其他几个选择后,这为我解决了问题。
This solved the issue for me after attempting several other options.
关于
&lt; openssl安装前缀&gt;
的疑问是,我将编辑澄清的问题。关于如何使Pyenv安装版本成功地尝试了我发现有关该主题的所有内容,这是对我有用的唯一内容:
对于每个新版本,我都使用此命令并有效。
请注意:
pyenv install xx.xx
,它并没有起作用,我总是必须使用完整的命令no不管是什么。对所有这些混乱都不满意,但至少现在我可以使用22.04进行工作。
编辑:我尝试了Jakob的建议将其添加到.bashrc,因此:
然后我做了
$ shell
重新加载它,然后pyenv install xx.xx.xx.xx
工作正常。About the doubt on what
<openssl install prefix>
is, I'll edit the question clarifying it.About how to make pyenv install versions successfully, after trying everything I found about the topic that's the only thing that worked for me:
For every new version, I use this command and it works.
Note that:
pyenv install xx.xx
, I always have to use the full command no matter what.Not happy at all with all this mess but at least now I can use 22.04 for working.
Edit: I tried Jakob's suggestion to add it to .bashrc, like this:
Then I did
$SHELL
to reload it, and thenpyenv install xx.xx.xx
worked fine.我通过在Ubuntu 22.04.1 LTS上安装libssl-dev来解决此错误
I managed to solve this error by installing libssl-dev on Ubuntu 22.04.1 LTS
上下文
我遇到了POP!_OS 22.04(基于Ubuntu 22.04)的错误,我将其用作Homebrew作为包装管理人员之一。
我无法获得上述工作的任何答案,也无法提出任何建议 https:https: //github.com/pyenv/pyenv/wiki/common-build-problems 上班。
解决方案
对我有用的是(暂时)卸载Homebrew OpenSSL软件包,确保通过APT-GET安装OpenSSL V3,然后(选择)通过Homebrew重新安装OpenSSL。
注意 :这不是解决方案,而是解决方案。这不是每个人,但希望这对我以外的人有帮助。
Context
I had the same error from Pop!_OS 22.04 (based on Ubuntu 22.04), which I use Homebrew as one of the package managers for.
I could not get any of the answers above to work, nor any of the suggestions https://github.com/pyenv/pyenv/wiki/Common-build-problems to work.
Workaround
What worked for me was (temporarily) uninstalling the Homebrew openssl package, making sure openssl v3 was installed via apt-get, and then (optionally) reinstalling openssl via Homebrew.
Note: This isn't a solution so much as a workaround. It's not for everyone, but hopefully it's helpful for someone beyond me.
整个下午,我都在同一问题上苦苦挣扎,上面没有解决方案,并且在一点点挖掘方面,将问题跟踪到
pyenv install
使用的GCC问题。 (请参阅,例如,在这里 和在这里。)简而言之, Python正在安装与自制的建筑依赖关系;但是,
pyenv install
似乎使用System GCC代替Homebrew的GCC,这会引起问题。一个对我有用的简单解决方案是用pyenv install
指向Homebrew的GCC,以让Pyenv在世界上运行:注意:检查正确的GCC版本(
gcc-ccc-11
,GCC-12
等)来自目录$(BREW-PREW-PREFIX GCC)/bin
。为了避免每次运行
pyenv install
时必须手动指向Homebrew的GCC,请为由Homebrew管理的Pyenv安装创建一个别名:I struggled with the same issue for a whole afternoon, with none of the solutions above working, and with a little bit of digging, tracked the problem down to issues with the gcc that
pyenv install
uses. (See, e.g., here and here.)In short, Python is being installed with Homebrew-managed build dependencies; however,
pyenv install
seems to use system gcc instead of Homebrew's gcc, which causes issues. A simple solution that worked for me is to point at Homebrew's gcc withpyenv install
to let pyenv operate in the world it knows:Note: check the correct gcc version (
gcc-11
,gcc-12
, etc.) from the directory$(brew --prefix gcc)/bin
.To avoid having to manually point to Homebrew's gcc every time running
pyenv install
, create an alias for Homebrew-managed pyenv installation:我也遇到了这个问题,不必要地解决了它。所以我希望这会有所帮助。
1-确保您遵循ubuntu的pyenv构建指南中的步骤noreferrer“> https://github.com/pyenv/pyenv/wiki#suggested-build-environment )并安装了所有必要的APT软件包。
2-如果
中的第一个项目,其中Openssl
显示了酿造码的路径。您可能想更改此问题。您只需卸载openssl@3和 [email&nbsp; email&nbsp;然后,默认情况下,它应该使用openssl的公共安装。我首先试图使其与Brew OpenSSL安装一起使用,但没有真正起作用。只有在从Brew中卸载OpenSSL之后,它就没有任何问题了。
I also had this problem and it took unnecessarily long to solve it. So I hope this helps.
1- Make sure that you followed the steps in the build guide of pyenv for Ubuntu (https://github.com/pyenv/pyenv/wiki#suggested-build-environment) and installed all the necessary apt packages.
2- If the first item in
where openssl
shows a path to brew dirs. You might want to change this. You can simply uninstall openssl@3 and [email protected] via brew. Then it should use the apt installation of openssl by default.I first tried to make it work with brew openssl installation but nothing really worked. Only after uninstalling openssl from brew it worked without any issues.
我也有同样的问题。
我在Ubuntu上使用Linuxbrew 20.04。以上答案对我不起作用,因此我选择保持简单,根本不使用Brew
Unstall Pyenv
BREW UNSTALL PYENV
从源中安装Pyenv的PyEnv,
现在您可以安装
pyenv install 3.11 install 3.11 .2
注意:Pyenv将在您打开新外壳后立即停止工作。因此,您需要强制初始化。只需更新您的〜/.. profile或〜/.bash_profile(在这种情况下,您需要注销)或更新您的〜/.bashrc
希望它适合像我一样对我的人读书。我花了比一天更长的时间来弄清楚最好的解决方案是避免brew for pyenv。
该解决方案也很优雅,因为它不需要您从酿造中添加任何别名或卸载OpenSSL。
I had your same exact issue.
I am using linuxbrew on Ubuntu 20.04. None of the above answers worked for me, so I opted for keeping it simple and simply not using pyenv provided by brew
uninstall pyenv
brew uninstall pyenv
Install pyenv from source
now you can install
pyenv install 3.11.2
note: pyenv will stop working as soon as you open a new shell. You therefore need to force initialisation. Just update your ~/.profile or ~/.bash_profile ( in this case you need to logout after that) or update your ~/.bashrc
Hope it works for the folks reading like it did for me. It took me longer than a day to figure out the best solution was simply avoid brew for pyenv.
This solution is also elegant because it does not require you to add any alias or uninstall openssl from your brew.
在我的主机上,我必须执行
brew install openssl
,它安装openssl@3但是brew -prefix openssl
仍然链接到openssl@1我需要完全输入建造Python的路径3.9.13。也许有更好的方法来执行前缀链接。
on my host I have to do a
brew install openssl
, it install openssl@3 butbrew --prefix openssl
still links to openssl@1I need to fully type out the path to build python 3.9.13. maybe there is a better way to do a prefix link.
遇到了同样的麻烦,对我来说,它在运行关注命令后起作用(check https:// github:// github .com/pyenv/pyenv/wiki#建议建立 - 环境)。
可以安装而没有其他标志。
Had same trouble, for me it worked after ran following command(check https://github.com/pyenv/pyenv/wiki#suggested-build-environment).
Could install without additional flags.