Найти - Пользователи
Полная версия: установка Django
Начало » Python для новичков » установка Django
1
sci-reseacher
Прошу помощи в установки Django.
$ python
Python 2.7.11 |Anaconda 4.0.0 (64-bit)| (default, Dec  6 2015, 18:08:32) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import django
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named django

$ sudo pip install Django 
The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): Django in /usr/lib/python2.7/dist-packages
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.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 cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

$ sudo -H pip install Django 
Requirement already satisfied (use --upgrade to upgrade): Django in /usr/lib/python2.7/dist-packages
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.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 cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

$ pip freeze
alabaster==0.7.7
anaconda-client==1.4.0
anaconda-navigator==1.1.0
argcomplete==1.0.0
astropy==1.1.2
Babel==2.2.0
backports-abc==0.4
backports.ssl-match-hostname==3.4.0.2
beautifulsoup4==4.4.1
bitarray==0.8.1
blaze==0.9.1
bokeh==0.11.1
boto==2.39.0
Bottleneck==1.0.0
Brian2==2.0rc1
cdecimal==2.3
cffi==1.5.2
chest==0.2.3
cloudpickle==0.1.1
clyent==1.2.1
colorama==0.3.7
conda==4.0.5
conda-build==1.20.0
conda-env==2.4.5
conda-manager==0.3.1
configobj==5.0.6
cryptography==1.3
cycler==0.10.0
Cython==0.23.4
cytoolz==0.7.5
dask==0.8.1
datashape==0.5.1
decorator==4.0.9
dill==0.2.4
docutils==0.12
dynd==0.7.3.dev1
enum34==1.1.2
et-xmlfile==1.0.1
fastcache==1.0.2
Flask==0.10.1
Flask-Cors==2.1.2
funcsigs==0.4
futures==3.0.3
gevent==1.1.0
greenlet==0.4.9
grin==1.2.1
h5py==2.5.0
HeapDict==1.0.0
idna==2.0
ipaddress==1.0.14
ipykernel==4.3.1
ipython==4.1.2
ipython-genutils==0.1.0
ipywidgets==4.1.1
itsdangerous==0.24
jdcal==1.2
jedi==0.9.0
Jinja2==2.8
jsonschema==2.4.0
jupyter==1.0.0
jupyter-client==4.2.2
jupyter-console==4.1.1
jupyter-core==4.1.0
llvmlite==0.9.0
locket==0.2.0
lxml==3.6.0
MarkupSafe==0.23
matplotlib==1.5.1
mistune==0.7.2
mpmath==0.19
multipledispatch==0.4.8
nbconvert==4.1.0
nbformat==4.0.1
networkx==1.11
nltk==3.2
nose==1.3.7
notebook==4.1.0
numba==0.24.0
numexpr==2.5
numpy==1.10.4
odo==0.4.2
openpyxl==2.3.2
pandas==0.18.0
partd==0.3.2
path.py==0.0.0
patsy==0.4.0
pep8==1.7.0
pexpect==4.0.1
pickleshare==0.5
Pillow==3.1.1
ply==3.8
psutil==4.1.0
ptyprocess==0.5
py==1.4.31
py-cpuinfo==0.1.6
pyasn1==0.1.9
pycairo==1.10.0
pycosat==0.6.1
pycparser==2.14
pycrypto==2.6.1
pycurl==7.19.5.3
pyflakes==1.1.0
Pygments==2.1.1
pyOpenSSL==0.15.1
pyparsing==2.0.3
pytest==2.8.5
python-dateutil==2.5.1
pytz==2016.2
PyYAML==3.11
pyzmq==15.2.0
QtAwesome==0.3.2
qtconsole==4.2.0
QtPy==1.0
redis==2.10.3
requests==2.9.1
rope==0.9.4
scikit-image==0.12.3
scikit-learn==0.17.1
scipy==0.17.0
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.10.0
snowballstemmer==1.2.1
sockjs-tornado==1.0.1
Sphinx==1.3.5
sphinx-rtd-theme==0.1.9
spyder==2.3.8
SQLAlchemy==1.0.12
statsmodels==0.6.1
sympy==1.0
tables==3.2.2
terminado==0.5
toolz==0.7.4
tornado==4.3
traitlets==4.2.1
unicodecsv==0.14.1
Werkzeug==0.11.4
xlrd==0.9.4
XlsxWriter==0.8.4
xlwt==1.0.0
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
FishHook
Научитесь работать в virtualenv и вопросы связанные с правами сами собой отпадут. Да и многие другие.
izuchaju_python
sci-reseacher
я устанавливал в линуксе такой командой
sudo pip3 install Django==1.9.6
Shaman
:~$ pip install django
Collecting django
Downloading Django-1.9.6-py2.py3-none-any.whl (6.6MB)
100% |████████████████████████████████| 6.6MB 106kB/s
Installing collected packages: django
Successfully installed django-1.9.6
sci-reseacher
С django работать начать удалось, но приходится запускать скрипты с указанием полного пути:
$ /usr/bin/python ./manage.py runserver

Проблема вот в этой “версии Python” - Anaconda:
$ python
Python 2.7.11 |Anaconda 4.0.0 (64-bit)| (default, Dec  6 2015, 18:08:32) 
Поставил pip-ом так просто - поиграться.

Подскажите, пожалуйста, как ее убрать из путей по умолчанию или еще лучше удалить и вернуться к стандартному для Ubuntu питону.

Вот мои неудачные попытки:
$ pip uninstall anaconda-client
Uninstalling anaconda-client-1.4.0:
  /home/user/anaconda2/bin/anaconda
  /home/user/anaconda2/bin/binstar
  /home/user/anaconda2/bin/conda-server
  /home/user/anaconda2/lib/python2.7/site-packages/anaconda_client-1.4.0-py2.7.egg-info
  /home/user/anaconda2/lib/python2.7/site-packages/binstar_client
Proceed (y/n)? y
Exception:
Traceback (most recent call last):
  File "/home/user/anaconda2/lib/python2.7/site-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/home/user/anaconda2/lib/python2.7/site-packages/pip/commands/uninstall.py", line 76, in run
    requirement_set.uninstall(auto_confirm=options.yes)
  File "/home/user/anaconda2/lib/python2.7/site-packages/pip/req/req_set.py", line 326, in uninstall
    req.uninstall(auto_confirm=auto_confirm)
  File "/home/user/anaconda2/lib/python2.7/site-packages/pip/req/req_install.py", line 746, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/home/user/anaconda2/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/home/user/anaconda2/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/home/user/anaconda2/lib/python2.7/shutil.py", line 303, in move
    os.unlink(src)
OSError: [Errno 13] Отказано в доступе: '/home/user/anaconda2/bin/anaconda'
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
user@reseacher:~/django/test$ sudo pip uninstall anaconda-client
[sudo] password for user: 
Cannot uninstall requirement anaconda-client, not installed
Storing debug log for failure in /home/user/.pip/pip.log
izuchaju_python
sci-reseacher
ответьте новичку, для чего вам анаконда?
sci-reseacher
izuchaju_python
sci-reseacherответьте новичку, для чего вам анаконда?

Просто из интереса посмотрел на пакет Brain2, с ним анаконда и затянулась … вот теперь бы корректно убрать ее из дефолтного Питона.
izuchaju_python
sci-reseacher
Brian2 ?
sci-reseacher
izuchaju_python
sci-reseacherBrian2 ?

да

izuchaju_python
sci-reseacher
Настройте иде с родным питоном и ставьте пакеты пипом, я думаю это ваш вариант.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB