我对python包安装过程感到有点恼火.具体来说,dist-packages目录中安装的软件包与site-packages目录之间的区别是什么?
这是我的情况:
我正在使用Ubuntu 10.04(Lucid Lynx).系统的默认Python是v2.6.5,但我需要Python v2.7.所以我从python.org下载了源代码并尝试安装它.
我第一次安装它时,我跑了:
cd Python2.7.4
./configure --prefix=/usr
make
su root
make install
Run Code Online (Sandbox Code Playgroud)
这会将Python 2.7安装到我的系统中.它将创建一个链接,"python",也/usr/bin链接到.因此,当我输入时,系统将为我启动Python 2.7.4,就像我输入时一样.python2.7/usr/bin>python>python2.7
但是当我以这种方式安装时:
cd Python2.7.4
./configure --prefix=/usr
make
su root
make altinstall
Run Code Online (Sandbox Code Playgroud)
链接"python" /usr/bin仍然存在,并且链接到python2.6默认系统版本.当然,我可以删除它并创建一个链接到的新软链接python2.7.
除了链接之外,命令"make install"和"make altinstall"之间有什么区别/usr/bin?
平台:ubuntu 17.04服务器
ubuntu 17.04服务器安装包括python 2.7和python 3.5.我从源手动安装了Python 3.6.3.然而,lsb_release -a失败了:
root@birds:~# lsb_release -a
Traceback (most recent call last):
File "/usr/bin/lsb_release", line 25, in <module>
import lsb_release
ModuleNotFoundError: No module named 'lsb_release'
Run Code Online (Sandbox Code Playgroud)
但是,如果我从修改文件lsb_release的第一线
#!/usr/bin/python3 -Es
,以
#!/usr/bin/python3.5 -Es
它再次工作.
root@birds:~# lsb_release -a
LSB Version: core-9.20160110ubuntu5-amd64:core-9.20160110ubuntu5-noarch:security-9.20160110ubuntu5-amd64:security-9.20160110ubuntu5-noarch
Distributor ID: Ubuntu
Description: Ubuntu 17.04
Release: 17.04
Codename: zesty
Run Code Online (Sandbox Code Playgroud)
以下是模块搜索路径:
python3.5
root@birds:~# python3.5
Python 3.5.3 (default, Sep 14 2017, 22:58:41)
[GCC 6.3.0 20170406] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> …Run Code Online (Sandbox Code Playgroud)