When i try to run the command:
sudo apt-get install virtualenv
The error I get in response is:
E: Unable to locate package virtualenv
The Ubuntu package is called python-virtualenv, not "virtualenv".
Try This :
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install virtualenv
It's also possible that you may not have run sudo apt-get update. It worked for me.
You need to add python before virtualenv because ubuntu package is
python-virtualenv not virtualenv.
sudo apt-get install python-virtualenv
you can install it with this instruction :
curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.10.1.tar.gz
tar xvfz virtualenv-1.10.1.tar.gz
cd virtualenv-1.10.1
sudo python setup.py install
sudo apt-get update
sudo apt-get install virtualenv
Yess, if any one wants to have a look at ( installing virtualenv: a basis for the installation of ) django installation, please run this command when the shell opens up in Ubuntu:
sudo apt-get install python-setuptools
sudo apt-get install python-easy_install virtualenv
and then run the commands to simply start the instructions followed on the following link(starting from the section "Setting up a new environment"):
http://www.django-rest-framework.org/tutorial/1-serialization/
Related
How Can I upgrade my python3 version from 3.5.2 to 3.7 in AWS EC2 ubuntu instance?
i am getting ImportError: No module named 'secrets' error while trying to runserver using command python3 manage.py runserver. I read somewhere that secrets are not supported in python3 version 3.5, and it works for only higher versions. My python version is 3.5.2. I want to upgrade the version.
I tried sudo apt-get install python3.7, but its not working:
Building dependency tree Reading state information... Done
E: Unable to locate package python3.7
E: Couldn't find any package by glob 'python3.7'
E: Couldn't find any package by regex 'python3.7'
Then I tried sudo update-alternatives --config python3, this is also not working
update-alternatives: error: no alternatives for python3
Try this :
first do this:
sudo apt update
sudo apt install software-properties-common
Then
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install python3.7
reference : https://linuxize.com/post/how-to-install-python-3-8-on-ubuntu-18-04/
Try this:
sudo apt-get update
sudo apt-get install build-essential libpq-dev libssl-dev openssl libffi-dev zlib1g-dev
sudo apt-get install python3-pip python3.7-dev
sudo apt-get install python3.7
In case you don't have the repository and so it fires a not-found package you first have to install this:
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
I am using a virtual box to build network simulator 3(ns3), Ubuntu version: Linux Server 20.04 LTS
the Linux command that I had executed are
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gcc g++ python python3 -y
sudo apt-get install python3-setuptools git mercurial -y
sudo apt-get install zip unzip
apt-get install cmake libc6-dev libc6-dev-i386 libclang-6.0-dev llvm-6.0-dev automake -y
sudo apt-get install -y python-gi-cairo
sudo apt-get install -y gir1.2-gtk-3.0
sudo apt-get install -y python-dev
sudo apt-get install -y python3-dev
sudo apt-get install -y qt5-default
sudo apt-get install -y python3-pygraphviz
sudo apt install python3-pip
sudo apt-get install -y graphviz libgraphviz-dev
sudo pip3 install pygraphviz --install-option='--include-path=/usr/include/graphviz' --install-option='--library-path=/usr/lib/graphviz'
Then I use the bake to install the ns3 through following this page: install ns3 with bake
although the "bake.py show" tell me that pygraphvix is Missing, but since it is not an essential dependency, so I ignore it and continue build the ns3
after i successfully built the ns3, I follow the instruction here to execute the "./waf shell" command in the folder "/source/ns-3.29"
then I run the command and get the error:
root#ns3simulator:/home/ns3/source/ns-3.29# python3 examples/wireless/mixed-wired-wireless.py
Traceback (most recent call last):
File "examples/wireless/mixed-wired-wireless.py", line 54, in <module>
import ns.applications
ModuleNotFoundError: No module named 'ns'
Could anyone please help me for this?Thanks in advance.
The problem
"import ns.applications"
ModuleNotFoundError: No module named 'ns'
is because there is a problem with the ns-3 installation and it is not able to do python binding itself and you need to manually configure it.
In my case, I have python 2.7 also installed
Go to
-> cd [PATH-to-your-ns3.29]
-> /usr/bin/python2.7 ./waf configure
it will enable the python binding like this
Waf configuration
after this when you can see the python binding enabled you can run your python script without any error.
Hope it helps !!!
./ns3 configure --enable-python-bindings
Then run the python example. The libraries should get built.
Here
How do you install PCL Library on Python/Ubuntu 18.04 LTS?
I've tried different ways to do so, without luck.
Trying to import pcl results in:
ImportError: libpcl_keypoints.so.1.7: cannot open shared object file: No such file or directory
Install it as a system-wide library, versus a Python module.
sudo add-apt-repository ppa:sweptlaser/python3-pcl
sudo apt update
sudo apt install python3-pcl
from here
I tried much to solve this issue. The drawback is here:
sudo apt-get install libpcl-dev -y
If you run this, it will install libpcl-dev with a higher version which will be conflicted with that libpcl-dev 1.7 you will install later. Here are some steps to raise the issue:
initially add Ubuntu 16 source list
then run below lines one by one.
sudo apt-get update
pip install python-pcl
sudo apt-get install libpcl-keypoints1.7
sudo apt-get install libpcl-outofcore1.7
sudo apt-get install libpcl-people1.7
sudo apt-get install libpcl-recognition1.7
sudo apt-get install libpcl-registration1.7
sudo apt-get install libpcl-segmentation1.7
sudo apt-get install libpcl-surface1.7
Now, if you get error "libpng12-0", do this:
sudo add-apt-repository ppa:linuxuprising/libpng12
sudo apt update
sudo apt-get install libpng12-0
sudo apt-get install libpcl-tracking1.7
sudo apt-get install libflann1.8
sudo apt-get install libpcl-visualization1.7
finally,
python
>>> import pcl
Congratulation : PCL is successfully imported
I am trying to install Python 3.6-dev with this command:
sudo apt-get install python3.6-dev
but I'm getting this error:
E: Unable to locate package python3.6-dev
E: Couldn't find any package by glob 'python3.6-dev'
E: Couldn't find any package by regex 'python3.6-dev'
Can anyone help? Why am I getting this error and what is the correct way to install the package?
sudo add-apt-repository ppa:deadsnakes/ppa \
&& sudo apt update \
&& sudo apt install python3.6
Edit:
The following PPA has been disabled, see discussion here and the new PPA here . So use the PPA mentioned above instead.
Original answer:
As mentioned by omajid the package is not availible in 16.04. But if you need it in 16.04 you can get it by adding for example the personal package repository of Felix Krull:
sudo add-apt-repository ppa:fkrull/deadsnakes
This ppa worked like a charm on ubuntu 16.04. Posting here for others.
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
For those who tried to install python-3.6 and got same error as that one above. This can help you as well us it helped me fix out the pb.
Open terminal then run command to add the PPA:
sudo add-apt-repository ppa:jonathonf/python-3.6
Then check updates and install Python 3.6 via commands:
sudo apt-get update
sudo apt-get install python3.6
Now to make sure you had install successufly just run python3.6-v or python3.6
For more details check here "How to Install Python 3.6.1 in Ubuntu 16.04 LTS"
Note: Linux 16.04 use python v 2.7 as default one if u needa use
python 3.6 in your project just set python-3.6 as default version for
this project. It's better then use sudo update-alternatives ...
command then your terminal will vanish :(.
The package is too new. It's not available in the older 16.04 release. It's available in the newer Ubuntu 16.10.
This ppa:jonathonf did not work for me.
ppa:deadsnakes
is working fine for now.
What worked was:
Open a terminal
Execute the following commands:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
sudo add-apt-repository ppa:deadsnakes/ppa
Guess they changed the name of repo.
I wanna set up scrapy cluster follow this link scrapy-cluster,Everything is ok before I run this command:
pip install -r requirements.txt
The requirements.txt looks like:
cffi==1.2.1
characteristic==14.3.0
ConcurrentLogHandler>=0.9.1
cryptography==0.9.1
...
I guess the above command means to install packages in requirements.txt.But I don't want it to specify the version,So I change it to this:
cat requirements.txt | while read line; do pip install ${line%%[>=]*} --user;done
When install cryptography,it gives me the error:
build/temp.linux-x86_64-2.7/_openssl.c:12:24:fatal error:pyconfig.h:No such file or directory
#include <pyconfig.h>
I don't know how to solved this , I have tried a lot of methods ,but failed. my system is centos 7, and the version of python is 2.7.5(default).
Besides, Is there any other scrapy frame which is appliable for a large number of urls . Thanks in advance
For Ubuntu, python2
apt-get install python-dev
For Ubuntu, python3
apt-get install python3-dev
I have solved it by myself. for the default python of centos, there is only a file named pyconfg-64.h in usr/include/python2.7/,So run the command
yum install python-devel
Then it works.
for python3.6,
apt-get install python3.6-dev
and
apt-get install libssl-dev libffi-dev
i use python 2 on ubuntu and got the same problem when installing cryptography.
after i run this command
apt-get install python-dev libssl-dev libffi-dev
then it works.
For Python 3.7 on Debian, the following works for me.
apt-get install python3.7-dev
and
apt-get install libssl-dev
You may also need:
apt-get install libffi-dev
On a Debian based distro (AntiX distro), together with apt-get install python3-dev, I also installed rust, to complete successfully the pip3 install cryptography command. So, I gave:
$ sudo apt-get install build-essential curl python3-dev libssl-dev libffi-dev
$ sudo curl https://sh.rustup.rs -sSf | sh
When prompted (Figure 1), type 1 and hit Enter on your keyboard.
Once it completes, you have to give following commands:
$ source $HOME/.cargo/env
$ source ~/.profile
$ pip3 install cryptography