I'm trying to change default python version to 2.7 in Cloud 9-IDE. I have managed to install correct version with command: nada-nix install python-2.7.4
It installs the version nicely, but default version stays 2.6.6.
$ python --version
Python 2.6.6
I have tried to update symbolic link to the correct version. But it says that I'm not privileged enough.
ln -nsf /usr/bin/python2.7.4 /usr/bin/python
ln: cannot remove `/usr/bin/python': Permission denied
What to do?
The Cloud9 package manager will install the python version 2.7 into ~/.nada-nix-profile/bin/python2.7. This is in your path so you can execute python2.7 from the terminal. If you want to symlink this to python just execute
$ ln -s ~/.nada-nix-profile/bin/python2.7 ~/.nada-nix-profile/bin/python
Afterwards you might have to close and reopen the terminal to activate the new version. Also the run button will then use python 2.7.
Related
I installed aws-cli following the aws docs
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html
$ curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
$ sudo installer -pkg AWSCLIV2.pkg -target /
When I verify their existence I get different Python versions.
$ python3 --version
Python 3.9.6
$ aws --version
aws-cli/2.2.26 Python/3.8.8 Darwin/20.6.0 exe/x86_64 prompt/off
Is this expected?
yeah that's expected. The CLI doesn't use your OS'es python, one is bundled into .pkg file as well as all other dependencies. This simplifies installation, testing and development. you can mess around with your OS's python all you like without breaking the CLI.
the guts of the code for this is here:
https://github.com/aws/aws-cli/blob/v2/scripts/make-bundle
When you use sudo for installing the package you are not referring to what's specific to your user's settings, the python version is one of those settings.
Python 3.8.8 is the system installed version( System Installed
Python 3.9.6 is specific to your user's settings, you might be using pipenv or any other setting which sets the python version for you.
Hence the differences.
$›› sudo python --version
Password:
Python 2.7.16
$›› python --version
Python 2.7.16
I am using CentOS 8 and want to download a library for Python2.
CentOS 8 has Python3 and its libraries installed by default.
I want to download python-chardet library for Python2. So I tried to install it as below -
$ sudo yum install python-chardet
I got this error -
No match for argument: python-chardet
Error: Unable to find a match: python-chardet
I searched for solution and as per this document you have to download its RPM binary and install it. https://centos.pkgs.org/7/centos-x86_64/python-chardet-2.2.1-3.el7.noarch.rpm.html
Downloading the binary file -
$ wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-chardet-2.2.1-3.el7.noarch.rpm
Using this rpm library I tried to install python-chardet as below -
$ sudo yum install ./python-chardet-2.2.1-3.el7.noarch.rpm
Here I got an error like this -
Error:
Problem: conflicting requests
- nothing provides /usr/bin/python needed by python-chardet-2.2.1-3.el7.noarch
Python version is
$ python -V
$ Python 2.7.16
/usr/bin/python returned this
Python 2.7.16 (default, Nov 17 2019, 00:07:27)
GCC 8.3.1 (RedHat) on linux2
Any help regarding this is much appreciated.
CentOS/RHEL 8 doesn't have any user-facing Python installed by default.
It has Python 3 installed for system apps like dnf, but to use it as a user, you need sudo dnf install python3.
Similarly, Python 2 and everything for it can be installed by using the appropriate package name suffix. To install Python 2 and the module you need:
sudo dnf install python2 python2-chardet
The recommendation/default is that the unversioned python command should not work and you should invoke the desired Python version on the shell by typing python2 instead of python.
If, for whatever reason you need unversioned python command to invoke Python 2, use the alternatives system:
sudo alternatives --set python /usr/bin/python2
I am trying to install cassandra version 2.2.0 and I found the compatible python version for it is 2.7.10 then I installed it.
when I type in terminal
python2.7 --version
Python 2.7.10
but when I launch cassandra server and want to start cassandra query language shell by typing
root#eman:/usr/local/cassandra# bin/cqlsh
bin/cqlsh: 19: bin/cqlsh: python: not found
how could I fix this issue
thanks in advance
For centos 8 and other similarly:
Install python 2.7
Then, prior to invoking cqlsh, run:
sudo alternatives --set python /usr/bin/python2
It seems that python is not installed on your machine (for whatever reason).
cqlsh shells out to python (in a rather strange way): https://github.com/spiside/cqlsh/blob/6f5b680fed2e48e37107fd1da272e351e5ac257d/cqlsh#L1-L30
Unrelated to this stackoverflow issue, I attempted to fix (and probably fixed) this in the latest version of cqlsh: https://github.com/spiside/cqlsh/commit/a880445ec9d05cfa552928d5a88d1457640456b6
If you can upgrade cqlsh it may fix this.
If you can't upgrade cqlsh any of the following things should fix this:
- If you're on an debian-like system apt-get install python-minimal -- this provides the /usr/bin/python file that seems to be missing (for whatever reason)
- If your package manager has a package which provides the /usr/bin/python symlink, install that
- Otherwise, set up a symlink that's on your path, for example ln -sf /usr/bin/python2.7 /usr/local/bin/python
I've read the posts, I've seen the ticket about the dopy version and I've tried to do my due diligence, but...
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'DoError' is not defined
This is still kicking my arse. I'm running OS X El Capitan. I've installed python + pip via Homebrew and I've tried installing Ansible via both Homebrew and pip. I'm still getting the error. What am I missing?
$ which python
/usr/local/bin/python
$ which pip
/usr/local/bin/pip
$ which ansible
/usr/local/bin/ansible
$ python --version
Python 2.7.11
$ pip --version
pip 8.1.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
$ ansible --version
ansible 2.0.1.0
config file = /Users/robwilkerson/Development/uw/ansible-servers/ansible.cfg
configured module search path = Default w/o overrides
$ pip list
...
dopy (0.3.5)
...
I've tried everything I can think of. If I use the system python and try to install pip without ansible I get an OpenSSL error that's a known issue.
I could really use a shove in the right direction.
I recommend to:
use Python 3.x
use virtual environment for ansible and python modules, eg. python3 -m venv ~/.venv && . ~/.venv/bin/activate
pip install -IU pip && pip install ansible dopy
I installed Python 2.7.9 from (https://www.python.org/downloads/windows/), and then Cygwin 2.8.59. But I had problems when installing numpy.
pip install numpy
error: Unable to find vcvarsall.bat
So I uninstalled python using set-x86.exe (Cygwin installer). Now my commands python and pip are these:
$ which python
/cygdrive/c/Python27/python
$ which pip
/cygdrive/c/Python27/Scripts/pip
I could installed numpy using pip, and execute files by "python test.py". I, however, cannot use interactive console. If I type
$python
the console freezes and I cannot do anything other than Ctrl+C.
How should I do to use the command, "python"?
Try
cygstart /cygdrive/c/Python27/python.exe
According to this question: Using Windows Python from Cygwin
cygwin is just going to hang because windows doesn't think that the cygwin command 'Python' means interactive console, and will not flush the buffer as if it were an interactive console.