我试图在ubuntu16.04 LTS上安装python3.6,但遇到了一些问题。我尝试添加死蛇/ppa并安装它,但没有成功。这可能是因为不再有用于xenial安装的python3.6了?
root@c2d64b30b259:~# apt-add-repository ppa:deadsnakes/ppa
root@c2d64b30b259:~# apt update
root@c2d64b30b259:~# apt install python3.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3.6
E: Couldn't find any package by glob 'python3.6'
E: Couldn't find any package by regex 'python3.6'
https://launchpad.net/~死蛇/+档案/ubuntu/ppa/+包
我还尝试构建源。以下命令运行良好。
root@c2d64b30b259:~/Python-3.6.0# ./configure
root@c2d64b30b259:~/Python-3.6.0# make
root@c2d64b30b259:~/Python-3.6.0# make install
然而,当运行一些导入模块的python脚本时,我会遇到以下错误。
import pandas as pd
File "/usr/local/lib/python3.6/site-packages/pandas/__init__.py", line 55, in <module>
from pandas.core.api import (
File "/usr/local/lib/python3.6/site-packages/pandas/core/api.py", line 24, in <module>
from pandas.core.groupby import Grouper, NamedAgg
File "/usr/local/lib/python3.6/site-packages/pandas/core/groupby/__init__.py", line 1, in <module>
from pandas.core.groupby.generic import ( # noqa: F401
File "/usr/local/lib/python3.6/site-packages/pandas/core/groupby/generic.py", line 44, in <module>
from pandas.core.frame import DataFrame
File "/usr/local/lib/python3.6/site-packages/pandas/core/frame.py", line 115, in <module>
from pandas.core.series import Series
File "/usr/local/lib/python3.6/site-packages/pandas/core/series.py", line 84, in <module>
import pandas.plotting
File "/usr/local/lib/python3.6/site-packages/pandas/plotting/__init__.py", line 59, in <module>
from pandas.plotting._core import (
File "/usr/local/lib/python3.6/site-packages/pandas/plotting/_core.py", line 17, in <module>
import pandas.plotting._matplotlib # noqa
File "/usr/local/lib/python3.6/site-packages/pandas/plotting/_matplotlib/__init__.py", line 3, in <module>
from pandas.plotting._matplotlib.boxplot import (
File "/usr/local/lib/python3.6/site-packages/pandas/plotting/_matplotlib/boxplot.py", line 4, in <module>
from matplotlib.artist import setp
File "/usr/local/lib/python3.6/site-packages/matplotlib/__init__.py", line 107, in <module>
from . import cbook, rcsetup
File "/usr/local/lib/python3.6/site-packages/matplotlib/rcsetup.py", line 28, in <module>
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
File "/usr/local/lib/python3.6/site-packages/matplotlib/fontconfig_pattern.py", line 15, in <module>
from pyparsing import (Literal, ZeroOrMore, Optional, Regex, StringEnd,
File "/usr/local/lib/python3.6/site-packages/pyparsing/__init__.py", line 130, in <module>
__version__ = __version_info__.__version__
AttributeError: 'version_info' object has no attribute '__version__'
如有任何建议,我们将不胜感激。请注意,我在docker环境中运行ubuntu16.04 LTS。
似乎问题出在我构建在线获得的源代码上。使用以下链接中的源代码重新安装似乎解决了我的问题。
https://github.com/deadsnakes/python3.6