我是Linux新手,正试图在我的机器上设置Python / Django! 我从源文件安装了Python 3.3,并将其编译到/usr/local/bin 。 然后,我在/usr/bin/python和/usr/local/bin/python3之间创build了一个符号链接,以便每当从命令行调用python时,都会使用最新版本。
现在我正在尝试安装MySQL Python,并得到以下输出:
apt-get install python-mysqldb Reading package lists... Done Building dependency tree Reading state information... Done python-mysqldb is already the newest version. The following extra packages will be installed: apt-listchanges python-apt Suggested packages: python-glade2 python-gtk2 python-apt-dbg python-vte python-apt-doc The following packages will be upgraded: apt-listchanges python-apt 2 upgraded, 0 newly installed, 0 to remove and 142 not upgraded. 3 not fully installed or removed. Need to get 0 B/394 kB of archives. After this operation, 250 kB of additional disk space will be used. Do you want to continue [Y/n]? Y Traceback (most recent call last): File "/usr/bin/apt-listchanges", line 28, in <module> import apt_pkg ImportError: No module named 'apt_pkg'
有想法该怎么解决这个吗? 或者如何清理这个安装的任何提示(如果这个太破碎了)?
在Debian中太多的软件包仍然依靠Python 2.x. 因此,几乎每个人都需要安装Python 2.x。
通常,以下是Python 2.x和3.x:
/usr/bin/python是指Python 2.x二进制文件 /usr/bin/python3是指Python 3.x二进制文件 要查看计算机上当前安装的Python版本,请运行:
ls -l /usr/bin/python*
(结果在eg /usr/bin/python2.7 )
删除符号链接: rm -i /usr/bin/python
要创build符号链接: ln -s /usr/bin/python2.7 /usr/bin/python