python 手動裝包報錯:error: can't create or remove files in install directory


python 手動裝包報錯:error: can't create or remove files in install directory

沒有權限,需要授權,或者使用 sudo 命令

這里需要注意的是,裝好之后只能在包目錄使用安裝的包,,其他環境不行

[test@localhost redis-2.10.3]$ python setup.py install
running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/test-easy-install-84826.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/lib/python2.7/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  https://pythonhosted.org/setuptools/easy_install.html

Please make the appropriate changes for your system and try again.

[test@localhost redis-2.10.3]$ sudo python setup.py install
[sudo] test 的密碼:
running install
running bdist_egg
running egg_info
writing redis.egg-info/PKG-INFO
writing top-level names to redis.egg-info/top_level.txt
writing dependency_links to redis.egg-info/dependency_links.txt
reading manifest file 'redis.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '__pycache__'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
writing manifest file 'redis.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/redis
copying redis/__init__.py -> build/lib/redis
copying redis/_compat.py -> build/lib/redis
copying redis/client.py -> build/lib/redis
copying redis/connection.py -> build/lib/redis
copying redis/exceptions.py -> build/lib/redis
copying redis/lock.py -> build/lib/redis
copying redis/sentinel.py -> build/lib/redis
copying redis/utils.py -> build/lib/redis
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/redis
copying build/lib/redis/__init__.py -> build/bdist.linux-x86_64/egg/redis
copying build/lib/redis/_compat.py -> build/bdist.linux-x86_64/egg/redis
copying build/lib/redis/client.py -> build/bdist.linux-x86_64/egg/redis
copying build/lib/redis/connection.py -> build/bdist.linux-x86_64/egg/redis
copying build/lib/redis/exceptions.py -> build/bdist.linux-x86_64/egg/redis
copying build/lib/redis/lock.py -> build/bdist.linux-x86_64/egg/redis
copying build/lib/redis/sentinel.py -> build/bdist.linux-x86_64/egg/redis
copying build/lib/redis/utils.py -> build/bdist.linux-x86_64/egg/redis
byte-compiling build/bdist.linux-x86_64/egg/redis/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/redis/_compat.py to _compat.pyc
byte-compiling build/bdist.linux-x86_64/egg/redis/client.py to client.pyc
byte-compiling build/bdist.linux-x86_64/egg/redis/connection.py to connection.pyc
byte-compiling build/bdist.linux-x86_64/egg/redis/exceptions.py to exceptions.pyc
byte-compiling build/bdist.linux-x86_64/egg/redis/lock.py to lock.pyc
byte-compiling build/bdist.linux-x86_64/egg/redis/sentinel.py to sentinel.pyc
byte-compiling build/bdist.linux-x86_64/egg/redis/utils.py to utils.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying redis.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying redis.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying redis.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying redis.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/redis-2.10.3-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing redis-2.10.3-py2.7.egg
Copying redis-2.10.3-py2.7.egg to /usr/lib/python2.7/site-packages
Adding redis 2.10.3 to easy-install.pth file

Installed /usr/lib/python2.7/site-packages/redis-2.10.3-py2.7.egg
Processing dependencies for redis==2.10.3
Finished processing dependencies for redis==2.10.3
[test@localhost redis-2.10.3]$


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM