I am trying to install Django on my a new mac which I got yesterday. I am switching over from a Windows, but I didn’t think that should have been much of an issue. Every time I try install either the version 1.6.5 or the development version I keep on getting the same error:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 215, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 205, in clobber
os.makedirs(destdir)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/django'
Storing debug log for failure in /Users/Peter/Library/Logs/pip.log
Окунулся в пайтон и начал погружаться в Джанго, но при попытке установить Джанго столкнулся с проблемой. Я ранее уже знакомился с этим стэком, но дело было давно, вот решил вернуться. Это я к тому, что после проблемы с установкой джанго возникла и проблема обновления пип. Я попытался разобраться в ошибках, но знаний пока что явно маловато, поэтому я Не теряя времени решил обратиться к общественности, ну и параллельно продолжать изучение вопроса. Ниже приведу данные из консоли, после установки джанго и попытки обновления пип.
PS
Ну и к слову, я правильно помню, что если необходимо установить джанго, к примеру, 2.2, нужно указать $ pip install django@2.2
?
***
$ pip install django
Collecting django
Downloading https://files.pythonhosted.org/packages/a9/4f/8a247eee2958529a6a80 5d38fbacd9764fd566462fa0016aa2a2947ab2a6/Django-3.0.5-py3-none-any.whl (7.5MB)
Collecting asgiref~=3.2 (from django)
Downloading https://files.pythonhosted.org/packages/68/00/25013f7310a56d17e1ab 6fd885d5c1f216b7123b550d295c93f8e29d372a/asgiref-3.2.7-py2.py3-none-any.whl
Collecting pytz (from django)
Downloading https://files.pythonhosted.org/packages/e7/f9/f0b53f88060247251bf4 81fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl (509kB )
Collecting sqlparse>=0.2.2 (from django)
Downloading https://files.pythonhosted.org/packages/85/ee/6e821932f413a5c4b76b e9c5936e313e4fc626b33f16e027866e1d60f588/sqlparse-0.3.1-py2.py3-none-any.whl (40 kB)
Installing collected packages: asgiref, pytz, sqlparse, django
Exception:
Traceback (most recent call last):
File "c:program files (x86)pythonpython35libsite-packagespipbasecommand .py", line 211, in main
status = self.run(options, args)
File "c:program files (x86)pythonpython35libsite-packagespipcommandsin stall.py", line 311, in run
root=options.root_path,
File "c:program files (x86)pythonpython35libsite-packagespipreqreq_set .py", line 646, in install
**kwargs
File "c:program files (x86)pythonpython35libsite-packagespipreqreq_ins tall.py", line 803, in install
self.move_wheel_files(self.source_dir, root=root)
File "c:program files (x86)pythonpython35libsite-packagespipreqreq_ins tall.py", line 998, in move_wheel_files
isolated=self.isolated,
File "c:program files (x86)pythonpython35libsite-packagespipwheel.py", line 339, in move_wheel_files
clobber(source, lib_dir, True)
File "c:program files (x86)pythonpython35libsite-packagespipwheel.py", line 310, in clobber
ensure_dir(destdir)
File "c:program files (x86)pythonpython35libsite-packagespiputils__ini t__.py", line 71, in ensure_dir
os.makedirs(path)
File "c:program files (x86)pythonpython35libos.py", line 241, in makedirs
mkdir(name, mode)
PermissionError: [WinError 5] ▒▒▒▒▒▒▒▒ ▒ ▒▒▒▒▒▒▒: 'c:\program files (x86)\pyth on\python35\Lib\site-packages\asgiref'
You are using pip version 7.1.2, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
* * *
$ python -m pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
Installing collected packages: pip
Found existing installation: pip 7.1.2
Uninstalling pip-7.1.2:
Exception:
Traceback (most recent call last):
File "C:Program Files (x86)PythonPython35libshutil.py", line 538, in move
os.rename(src, real_dst)
PermissionError: [WinError 5] ▒▒▒▒▒▒▒▒ ▒ ▒▒▒▒▒▒▒: 'c:\program files (x86)\python\python35\lib\site-packages\pip-7.1.2.dist-info\description.rst' -> 'C:\Users\metro\AppData\Local\Temp\pip-2_7w9mjz-uninstall\program files (x86)\python\python35\lib\site-packages\pip-7.1.2.dist-info\description.rst'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:Program Files (x86)PythonPython35libsite-packagespipbasecommand.py", line 211, in main
status = self.run(options, args)
File "C:Program Files (x86)PythonPython35libsite-packagespipcommandsinstall.py", line 311, in run
root=options.root_path,
File "C:Program Files (x86)PythonPython35libsite-packagespipreqreq_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
File "C:Program Files (x86)PythonPython35libsite-packagespipreqreq_install.py", line 716, in uninstall
paths_to_remove.remove(auto_confirm)
File "C:Program Files (x86)PythonPython35libsite-packagespipreqreq_uninstall.py", line 125, in remove
renames(path, new_path)
File "C:Program Files (x86)PythonPython35libsite-packagespiputils__init__.py", line 315, in renames
shutil.move(old, new)
File "C:Program Files (x86)PythonPython35libshutil.py", line 553, in move
os.unlink(src)
PermissionError: [WinError 5] ▒▒▒▒▒▒▒▒ ▒ ▒▒▒▒▒▒▒: 'c:\program files (x86)\python\python35\lib\site-packages\pip-7.1.2.dist-info\description.rst'
You are using pip version 7.1.2, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
I am trying to install Django on my a new mac which I got yesterday. I am switching over from a Windows, but I didn’t think that should have been much of an issue. Every time I try install either the version 1.6.5 or the development version I keep on getting the same error:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 215, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 205, in clobber
os.makedirs(destdir)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/django'
Storing debug log for failure in /Users/Peter/Library/Logs/pip.log
I install django through :
git clone git://github.com/django/django.git
pip install -e django/
I use Ubuntu 16.04.
But some errors occur :
Obtaining file:///home/leo/django
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/leo/django/setup.py", line 32, in <module>
version = __import__('django').get_version()
File "django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "django/utils/version.py", line 60, in <module>
@functools.lru_cache()
AttributeError: 'module' object has no attribute 'lru_cache'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /home/leo/django/
How to fix this ?
Thank you.
asked Feb 13, 2017 at 3:15
4
The last Django version does not support python 2.7.
If you really want to use python 2.7 and also use Django you should install a previous Django version.
The latest supported is: 1.11
Therefore, just run:
pip install django==1.11
answered Dec 11, 2017 at 3:47
georgegeorge
1,72816 silver badges16 bronze badges
3
This because django version you have needs python3
interpreter. so try to run the same command using pip3
To install pip3
sudo apt-get -y install python3-pip
then run
pip3 install -e django/
answered Jul 4, 2017 at 12:54
vimal1083vimal1083
8,4396 gold badges33 silver badges50 bronze badges
1
You can install a Python 2 version of Django using git — you just need to checkout the correct release tag first. Try something like
git clone git://github.com/django/django.git
cd django
git checkout 1.11.0
cd ..
pip install -e django/
That said, you are much better off using pip directly, as other solutions suggest.
answered Apr 11, 2018 at 12:53
JonJon
3,5532 gold badges17 silver badges24 bronze badges
Right > c:Python27Scripts>pip install django==1.11
Wrong > c:Python27Scripts>pip2.7 install django
c:Python27Scripts>pip2.7 install django
Collecting django
Using cached Django-2.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:usersshyvappdatalocaltemppip-build-idpp6jdjangosetup.py", line 32, in <module>
version = __import__('django').get_version()
File "django__init__.py", line 1, in <module>
from django.utils.version import get_version
File "djangoutilsversion.py", line 61, in <module>
@functools.lru_cache()
AttributeError: 'module' object has no attribute 'lru_cache'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:usersshyvappdatalocaltemppip-build-idpp6jdjango
c:Python27Scripts>pip install django==1.11
Collecting django==1.11
c:python27libsite-packagespip_vendorrequestspackagesurllib3utilssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cau
SNIMissingWarning
c:python27libsite-packagespip_vendorrequestspackagesurllib3utilssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL co
InsecurePlatformWarning
Downloading Django-1.11-py2.py3-none-any.whl (6.9MB)
100% |################################| 6.9MB 108kB/s
Collecting pytz (from django==1.11)
Downloading pytz-2017.3-py2.py3-none-any.whl (511kB)
100% |################################| 512kB 922kB/s
Installing collected packages: pytz, django
Successfully installed django-1.11 pytz-2017.3
answered Dec 20, 2017 at 11:09
DkingDking
12 bronze badges
3 / 3 / 1 Регистрация: 17.12.2018 Сообщений: 257 |
|
1 |
|
06.02.2019, 07:13. Показов 5336. Ответов 7
Смотрела видео урок Дударя, он показывал как установить джанго, но когда я пишу pip install django выдаёт ошибку. Pip у меня установлен, ибо версия питона выше 3.4.
0 |
3 / 3 / 1 Регистрация: 17.12.2018 Сообщений: 257 |
|
06.02.2019, 07:17 [ТС] |
2 |
1) Вот версия питона когда я пишу «py»: 2) Вот когда я пишу python: 3) pip установлен: 4) Вот ошибка при установки джанго:
0 |
3 / 3 / 1 Регистрация: 17.12.2018 Сообщений: 257 |
|
06.02.2019, 07:30 [ТС] |
3 |
5) Версия pip: Миниатюры
0 |
3 / 3 / 1 Регистрация: 17.12.2018 Сообщений: 257 |
|
06.02.2019, 07:55 [ТС] |
4 |
УРА ПОЛУЧИЛОСЬ УСТАНОВИТЬ! Антивирус Касперского тупо блокировал какие-то хосты, поэтому не получалось установить соединение с сайтом. Я его отключила и получилось установить.
1 |
5407 / 3831 / 1214 Регистрация: 28.10.2013 Сообщений: 9,554 Записей в блоге: 1 |
|
06.02.2019, 12:35 |
5 |
Антивирус Касперского тупо блокировал какие-то хосты Пакет можно установить локально — просто скачав с репозитория pypi.org whl архив пакета. Код pip install путь_до_загруженного_пакета.whl Пакет также можно установить просто склонировал его с репозитория на гитхабе.
0 |
m0nte-cr1st0 1040 / 575 / 242 Регистрация: 15.01.2019 Сообщений: 2,178 Записей в блоге: 1 |
||||
06.02.2019, 13:05 |
6 |
|||
Django с большой нужно писать просто
И Касперский тут не причём, просто на этот раз вы ввели всё верно, обычное совпадение, не более.
0 |
3 / 3 / 1 Регистрация: 17.12.2018 Сообщений: 257 |
|
06.02.2019, 13:10 [ТС] |
7 |
m0nte-cr1st0, я с большой тоже писала, ибо он в своём уроке писал с большой буквы, но не устанавливалось.
0 |
102 / 75 / 38 Регистрация: 08.11.2017 Сообщений: 271 |
|
06.02.2019, 13:22 |
8 |
Решениеm0nte-cr1st0, большая буква здесь не причём.
0 |