我在自己的pycharm的terminal输入pip install greenlet ,但是出现了错误,以下是我的解决思路
2,我输入sudo pip install gevent,变成下面的
WARNING: The directory '/Users/victoworld/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Requirement already satisfied: gevent in ./opt/anaconda3/lib/python3.9/site-packages (21.8.0)
Requirement already satisfied: greenlet<2.0,>=1.1.0 in ./opt/anaconda3/lib/python3.9/site-packages (from gevent) (1.1.1)
Requirement already satisfied: setuptools in ./opt/anaconda3/lib/python3.9/site-packages (from gevent) (58.0.4)
Requirement already satisfied: zope.interface in ./opt/anaconda3/lib/python3.9/site-packages (from gevent) (5.4.0)
Requirement already satisfied: zope.event in ./opt/anaconda3/lib/python3.9/site-packages (from gevent) (4.5.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
2,以上说的我需要安装虚拟环境,所以我输入pip3 install --user virtualenv安装虚拟环境
好像没啥卵用!
3,发现是因为没有修改它的读写权限,所以我 sudo chown -R victoworld /Users/victoworld/Library/Caches/pip ,然后退出终端,重启终端,重启动,输入了sudo pip install event.还是得到同样的结果
4,我输入pip install gevent ,显示的是
Requirement already satisfied: gevent in ./opt/anaconda3/lib/python3.9/site-packages (21.8.0)
Requirement already satisfied: setuptools in ./opt/anaconda3/lib/python3.9/site-packages (from gevent) (58.0.4)
Requirement already satisfied: zope.event in ./opt/anaconda3/lib/python3.9/site-packages (from gevent) (4.5.0)
Requirement already satisfied: zope.interface in ./opt/anaconda3/lib/python3.9/site-packages (from gevent) (5.4.0)
Requirement already satisfied: greenlet<2.0,>=1.1.0 in ./opt/anaconda3/lib/python3.9/site-packages (from gevent) (1.1.1)
(base) victoworld@leimingmingdeMacBook-Pro ~ % pip install greenlet
Requirement already satisfied: greenlet in ./opt/anaconda3/lib/python3.9/site-packages (1.1.1)
5,查到了相同经历的人,发现可能是虚拟环境的路径问题?我需要去了解这个问题!
6,我又发现了自己的python解释器可能导致不能兼容,所以我想去升级版本,还有结合网上的信息,升级pygame,我下载了python最新版本的解释器,但是我栽在不清楚,如何配置解释器上面,估计是造成了解释器混乱。所以我把python3.9 python3.10删掉了,只剩下最新版本,我在最新版本的py charm的终端,打开后,发现能够安装pip install greenlet,那我断定,确实是版本问题!但是新建py文件,发现我没法读写,根本建立不了,我打算好好研究一下怎么配置好python解释器!
7,实践证明,我确实是需要升级那个python版本,我在原来的文件project中,add了最新的python解释器,然后再pip install greenlet ,就下载成功了,然后也导入了greenlet这个模块!
注意‼️这种情况下,把思路拉回来,就很有可能是自己现在的python解释器版本不兼容了,升级就好了!