首页 > 解决方案 > 如何在命令 pip install Cython 期间修复错误

问题描述

当我尝试安装 cython 时,您知道如何解决以下错误吗?

PermissionError:[Errno 13] 权限被拒绝:'/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/cython.py'

[namesurname@machine cmake-3.20.0]$ pip install Cython

Collecting Cython
  Using cached https://files.pythonhosted.org/packages/d7/04/5890b30102782a3ec9970df3c10f024298803d89624ee23cf75d09bd2548/Cython-0.29.24-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: Cython
Exception:
Traceback (most recent call last):
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/commands/install.py", line 351, in run
    strip_file_prefix=options.strip_file_prefix,
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 854, in install
    strip_file_prefix=strip_file_prefix
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 1069, in move_wheel_files
    strip_file_prefix=strip_file_prefix,
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/wheel.py", line 323, in clobber
    shutil.copyfile(srcfile, destfile)
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:

PermissionError: [Errno 13] Permission denied: '/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/cython.py'

You are using pip version 9.0.1, however version 21.1.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

[namesurname@machine cmake-3.20.0]$ 

如果没有适合此类问题的论坛,请告诉我一个合适的论坛!

标签: pipcython

解决方案


使用$ pip install cython --user. 更好的是,使用 virtualenv。永远不会做sudo pip install


推荐阅读