无法安装MySQL-python软件包

时间:2019-02-24 21:01:38

标签: mysql centos7 mysql-python

我刚刚在托管公司中创建了CentOS 7。

我需要安装依赖于MySQL-python软件包的应用程序。

我尝试安装该软件包,但不可用:

root@vps [/var/frappe]# yum install MySQL-python
Loaded plugins: fastestmirror, universal-hooks
Loading mirror speeds from cached hostfile
 * EA4: 208.100.0.204
 * base: ftpmirror.your.org
 * epel: mirror.steadfastnet.com
 * extras: ftpmirror.your.org
 * ius: muug.ca
 * updates: ftpmirror.your.org
No package MySQL-python available.
Error: Nothing to do
root@vps [/var/frappe]#

为什么我不能安装它?一些解决方法?

编辑:

/etc/yum.conf

[main]
exclude=courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* mysql* nsd* p0f php* proftpd* pure-ftpd* spamassassin* squirrelmail*
tolerant=1
errorlevel=1
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release


#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

3 个答案:

答案 0 :(得分:5)

此软件包将在base存储库中提供:

$ yum whatprovides MySQL-python
MySQL-python-1.2.5-1.el7.x86_64 : An interface to MySQL
Repo        : base

以供参考:

$ cat /etc/yum.repos.d/centos.repo 
[base]
name=CentOS-$releasever - Base
baseurl=http://mirror.centos.org/centos/7/os/$basearch/
gpgcheck=1
enabled=1
protect=1
priority=5
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

在提供的yum.conf中看起来非常可疑的是配置exclude=mysql*与所需的软件包名称完全匹配。您要么必须删除该一种exclude模式,要么进行安装。或使用pip install MySQL-python安装软件包MySQL-python


RPM的{​​{1}}依赖项确认不需要其他MySQL-python软件包:

MySQL

documentation还说明了我想告诉的内容:

  

排除要从所有存储库中排除的软件包列表,因此$ repoquery --requires --resolve MySQL-python python-0:2.7.5-76.el7.x86_64 python-libs-0:2.7.5-76.el7.x86_64 MariaDB-compat-0:10.2.22-1.el7.centos.x86_64 glibc-0:2.17-260.el7.i686 mariadb-libs-1:5.5.60-1.el7_5.x86_64 zlib-0:1.2.7-18.el7.x86_64 glibc-0:2.17-260.el7.x86_64 openssl-libs-1:1.0.2k-16.el7.x86_64 的工作方式就像该软件包从未在存储库中一样。这应该是一个用空格分隔的列表。这是常用的,因此不会意外升级或安装软件包,但是可以用yum显示软件包的任何方式删除软件包。允许使用通配符(例如yum list*)的Shell glob。

最佳解决方案是:编辑?,然后将/etc/yum.conf模式exclude替换为mysql*-这样mysql-server* mysql-client* mysql-libs*服务器,客户端和libs仍将被排除在外,但将允许安装软件包MySQL


甚至有一种非常简单的方法可以解决该问题(请注意,以后将无法找到更新):

MySQL-python

答案 1 :(得分:0)

最好使用pip而不是yum作为Python的软件包管理器。 Create a Python virtual environment,将其激活,然后使用pip安装MySQL-python

python -m venv ~/mysqlstuff
source ~/mysqlstuff/bin/activate
pip install MySQL-python

答案 2 :(得分:0)

首先使用以下命令更新您的包裹管理器:

sudo yum update

然后使用以下命令安装pip软件包:

sudo yum install epel-release
sudo yum install python-pip

然后使用以下方式更新点子:

pip install --upgrade pip

最后安装MYSQL-python软件包:

pip install --user MySQL-python # user only

sudo pip install MySQL-python # system wide