为什么找不到aerospike(python)模块

为什么找不到aerospike(python)模块,python,python-3.x,linux,pip,Python,Python 3.x,Linux,Pip,我已经在centos7机器上运行了安装命令并安装了aerospike [ra222c@webphp-wcklssk]~% sudo pip install aerospike WARNING: The directory '/csnzoo/ra222c/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check th

我已经在centos7机器上运行了安装命令并安装了aerospike


[ra222c@webphp-wcklssk]~% sudo pip install aerospike
WARNING: The directory '/csnzoo/ra222c/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/csnzoo/ra222c/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting aerospike
  Downloading https://files.pythonhosted.org/packages/0d/ac/4f07557a897aad86b4583916eb17a46a9963d9e64901cd3c92f38781ba11/aerospike-3.9.0-cp34-cp34m-manylinux2010_x86_64.whl (3.9MB)
     |████████████████████████████████| 3.9MB 22.3MB/s 
Installing collected packages: aerospike
Successfully installed aerospike-3.9.0
[ra222c@webphp-wcklssk]~% python                    
Python 2.7.5 (default, Apr  9 2019, 14:30:50) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import aerospike
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named aerospike
>>> 
[ra222c@webphp-wcklssk]~% sudo pip3 install aerospike
WARNING: The directory '/csnzoo/ra222c/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/csnzoo/ra222c/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: aerospike in /usr/lib64/python3.4/site-packages (3.9.0)
[ra222c@webphp-wcklssk]~% python3
Python 3.6.0 (default, Jan 19 2017, 16:59:54) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import aerospike
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'aerospike'
>>> 

我更仔细地观察了我得到的错误的输出。看起来aerospike正在期待python3.4。我也在运行python3.6(作为默认的python3)。使用python3.4运行交互式shell可以解决以下问题:

[ra222c@webphp-wcklssk]~% python3.4
Python 3.4.10 (default, Oct  4 2019, 19:14:13) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import aerospike
>>> 

为什么要将pip与sudo一起使用,请阅读警告可能尝试
sudo-H pip安装aerospike--用户
停止将
sudo
pip安装
一起使用,因为这些可能会干扰系统站点软件包。使用
pip安装--user
或更好的方法,查看虚拟环境。它可以与python 3.6兼容,但我安装了一个适用于3.6的。因此有两种解决方案:使用正确版本的python或安装正确版本的aerospike。
[ra222c@webphp-wcklssk]~% python3.4
Python 3.4.10 (default, Oct  4 2019, 19:14:13) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import aerospike
>>>