![](/img/trans.png)
[英]error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied
[英]Getting Error while installing djangorestframework - Permission denied: '/usr/lib/python2.7/site-packages/djangorestframework-3.6.3.dist-info'
我想在fedora-25中安裝Django rest框架,但是當我運行以下命令時:
pip install djangorestframework
我收到以下錯誤:
Collecting djangorestframework
Using cached djangorestframework-3.6.3-py2.py3-none-any.whl
Installing collected packages: djangorestframework
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 326, in run
strip_file_prefix=options.strip_file_prefix,
File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 742, in install
**kwargs
File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 834, in install
strip_file_prefix=strip_file_prefix
File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 1037, in move_wheel_files
strip_file_prefix=strip_file_prefix,
File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 346, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 317, in clobber
ensure_dir(destdir)
File "/usr/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib64/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/djangorestframework-3.6.3.dist-info'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
當我嘗試使用sudo上面的命令時,出現以下錯誤
Collecting djangorestframework
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f0011a7bf10>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/djangorestframework/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f0013a4fe50>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/djangorestframework/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f0011788050>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/djangorestframework/
當我嘗試升級點子時
pip install --upgrade pip
再次出現權限拒絕錯誤,並使用sudo運行它時,出現以下錯誤
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7eff30658ed0>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7eff3262cf10>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/pip/
我該怎么辦 ? 還有其他安裝djangorestframework的方法嗎?
請幫我這個:(
嘗試使用virtualenv。
sudo apt-get install python-virtualenv
virtualenv myvenvname // create ur env
source myvenvname/bin/activate // activate it if it isnt already activated
在虛擬環境中安裝所有軟件包,以避免與其他軟件包沖突,這可能會解決您的問題。
另一件事是,您正在嘗試使用python 2.7安裝它,如我所見。 這是您想要的版本嗎? 如果要使用python 3安裝它,請執行以下操作:
pip3 install djangorestframework
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.