最近更新了python解釋器3.7
結果安裝gevent,在導入gevent之后就報錯了,錯誤信息如下
RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
return f(*args, **kwds)
看到現在寫這個問題的帖子不多,就先貼出來了。
只需要執行一下下面這段代碼就可以了
pip3 install -U --force-reinstall --no-binary :all: gevent
附上參數說明
-U, --upgrade Upgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used. --force-reinstall Reinstall all packages even if they are already up-to-date. --no-binary <format_control> Do not use binary packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either :all: to disable all binary packages, :none: to empty the set, or one or more package names with commas between them. Note that some packages are tricky to compile and may fail to install when this option is used on them.
這條命令的大概意思就是使用非二進制的包重新安裝gevent以及它的依賴。
總之在執行這個命令之后就完美的解決問題了。
目前安裝的gevent版本和greenlet版本分別是1.3.5和0.4.14