How to install Django in Ubuntu 11.10 - python

I am very new to Ubuntu OS and Python as well. I want to install Django. But i dont have easy_install and I tried below command to install pip
sudo apt-get install python-pip
I got an error as below
Unable to locate package python-pip
I tried below command as well
sudo apt-get install python-pip
and i got error as below
E: Package 'python-setuptools' has no installation candidate
I am very confused in installing django, How to successfully install django

First update repositories
sudo apt-get update
then try
sudo apt-get install python-pip python-dev build-essential python-setuptools
if nothing, you can install pip and setuptools packages manually. Download them from PyPI.

Install pip
To install or upgrade pip, securely download get-pip.py.
Then run the following (which may require administrator access):
sudo python get-pip.py
If setuptools (or distribute) is not already installed, get-pip.py will install setuptools for you.
To upgrade an existing setuptools (or distribute), run pip install -U setuptools
Upgrade pip
On Linux or OS X:
sudo pip install -U pip
Then you can download django using pip,
sudo pip install django

Install
First you need make sure you have Python install, here I take 2.7.6 as example. For how to install Python, you can go check this link:
https://askubuntu.com/questions/443048/python-2-7-6-on-ubuntu-12-04-how-to
Then you can start install Django and setup database as follow:
sudo apt-get install python-django
sudo apt-get install mysql-server
sudo apt-get install python-mysqldb
You can find more configuration detail in this link
http://yuwenqing.org/?p=108
Also, for less pain in future develop, you should deploy your Django application in python virtualEnv, here are some detail of why you need virtualEnv.
http://yuwenqing.org/?p=126

Related

Ubuntu says Python is on its latest version when its not. How do I update it

I am clueless here. I need to upgrade to python 3.8.0. So, I run this:
sudo apt-get install python3 3.8.0
But I get the following message:
As you can see. It writes "python3 is already the newest version". It is not.
Also, I get the "held broken packages" error after that. I am not sure if they are related.
you might have the newest version of tthat particular's repository.
try here:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.8
sudo apt install python3.8-distutils
python3.8 -m pip install --upgrade pip setuptools wheel

why 'pip install mysqlclient' not working in ubuntu 18.04 LTS

I have just created a virtual environment on my machine (I am running on ubuntu 18.04 LTS). I have the python version of 3.6.7 and now I want to install mysqlclient into my virtual environment.
After I do pip install mysqlclient it didn't work, instead it gave me errors saying;
Command "python.py egg_info" failed with error code 1 in /tmp/pip-install-zd21vfb3/mysqlclient/', and that the msql_config file is not found.
My setup tools are all up to date.
mysqlclient has a dependency on the mysql client & dev packages being installed. In order to fix this on ubuntu, you have to use apt-get to install a couple of mysql packages.
In your case, it looks like the missing mysql_config might be missing on your system. You can fix that by installing libmysqlclient-dev on ubuntu bionic.
In order to correctly install MySQLClient on a fresh Ubuntu 18.04 LTS you need to install each of the following:
# Replace python3.6 with which ever version of Python3 you are using
sudo apt-get install python3.6-dev
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
sudo apt-get install libssl-dev
The last one is often missed on answers but is required now.
Only then can you install it via pip. Also make sure to update pip so you are not using version 9 if that installs into your vevn.
I was getting the same error when building my docker container. I tried installing the following in sequence but did not work.
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
sudo apt-get install libssl-dev
Then this 👇 solved the problem.
sudo apt-get install default-libmysqlclient-dev
Check if you have already installed setuptools.
After that
in terminal
sudo apt-get install libmysqlclient-dev
Then(Keeping in mind to activate the virtual enviroment)
sudo pip3 install mysqlclient

How to install python packages like pip, numpy on Amazon EC2 - ubuntu

Need to install python packages like pip, numpy, cv2 on an Amazon EC2 instance of Ubuntu. I tried using sudo apt-get install python-pip but got below given error:
ubuntu#ip-172-31-35-131:~$ sudo apt-get install python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip
Try first sudo apt-get update then
sudo apt-get install python-pip
Have you tried the instructions here?
You can install pip from PyPa directly:
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
Your system may have a concurrent python3.x under the name python3, then you can install pip for it with python3 get-pip.py --user as well. (Or contrarily, python2.x under the name python2.)

"sudo pip install Django" => sudo: pip: command not found

This what my terminal is saying when trying to install Django.
MacBook-XXXX:~ Stephane$ sudo pip install Django
sudo: pip: command not found
I have tested in idle shell if pip is installed:
>>> import easy_install
>>> import pip
>>>
What am I doing wrong?
you need to install pip
sudo easy_install pip
pip is a package management system used for installing packages written in python. So first install pip and then Django.
sudo apt-get install python-pip.
And for installing django, follow
django installation steps.

Can't install mitmproxy:

Im trying to install mitmproxy on a Ubuntu 14.04 computer, but I'm getting error. I found on the web how I should install it by using this code:
sudo install pip mitmproxy
So I installed python, now when I run the command it works until I get this problem:
Command python.py egg_info failed with error code 1 in /tmp/pip_build_root/cryptography
I tried to update python but still the same
Exactly I installed python in this way:
sudo apt-get install python-pyasn1 python-flask python-urwid
What's wrong???
UPDATE
Here is the pip.log
You can also pip install from github:
In this order:
Install netlib: (sudo) pip install git+https://github.com/mitmproxy/netlib.git
Install mitmproxy: (sudo) pip install git+https://github.com/mitmproxy/mitmproxy.git
This will install all requisite libraries and provide you with the most up-to-date version of mitmproxy.
Judging by the log you got from pip the problem here is that the development libraries for libffi are not installed. You can rectify it with:
$ sudo apt-get install libffi-dev
and retry installing.
The clue in your error log is this line:
Package libffi was not found in the pkg-config search path.
If pkg-config is unable to find a library it means that the files needed to develop with this library are missing. On an Ubuntu or Debian system this usually means installing the package that has the name of the library plus -dev.
Running these 2 commands worked for me (Ubuntu 14.04)
sudo apt-get install python-pip python-dev libffi-dev libssl-dev
libxml2-dev libxslt1-dev libjpeg8-dev zlib1g-dev
sudo pip install mitmproxy
EDIT: You need to run this command before you will be able to use "mitmproxy -p port_number". since it gives error "Error: mitmproxy requires a UTF console environment."
export LC_ALL=en_US.UTF-8
EDIT 2: After installation, you need to generate certificate first and have to transfer it into your device then setup manual proxy by entering your computer's IP address and port on which you will run mitmproxy server. Use below commands to generate certificate:
sudo apt-get install libnss3-tools
certutil -d sql:$HOME/.pki/nssdb -A -t C -n mitmproxy -i ~/.mitmproxy/mitmproxy-ca-cert.pem
$ pip uninstall mitmproxy netlib
$ sudo apt-get install -y build-essential libssl-dev libffi-dev python-dev python-pip libxml2-dev libxslt-dev git
$ sudo pip install git+https://github.com/mitmproxy/netlib.git#master
sudo pip install git+https://github.com/mitmproxy/mitmproxy.git#master
$ sudo python #
>>> from netlib import certffi
>>> exit()

Categories

Resources