conflict with Python 2.7.6 and 2.7.9 on MAC - python

It seems my mac has multi-version of Python
python python2.6-config python3 pythoni pythonw2.6
python-config python2.7 python3.3 pythoni1 pythonw2.7
python2.6 python2.7-config python3.3-config pythonw pythonw3.3
Now the packages installed by PIP will be installed in Python 2.7.5
But the default Python is 2.7.6 , so I can not find the package when I use python shell.
How to fix it ?
% pip install pandas (git)-[feature/support-python-with-ruby-python]
...
Requirement already satisfied (use --upgrade to upgrade): six in /usr/local/lib/python2.7/site-packages (from python-dateutil->pandas)
Cleaning up...
[15:25:55](~/workspace/flyberry_projects/03-CFTC-COT/COT/lib)
% python (git)-[feature/support-python-with-ruby-python]
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pandas

Related

Have i installed the socks module in python?

list the packages beginnig at s.
pip list | grep ^s
setuptools 56.0.0
six 1.12.0
sniffio 1.2.0
socks 0
Why the version number is zero?
python3
Python 3.9.6 (default, Jul 14 2021, 09:15:03)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socks
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'socks'
debian#debian:~$ pip3 install socks
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: socks in /usr/local/lib/python3.7/dist-packages (0)
WARNING: You are using pip version 21.1.2; however, version 21.1.3 is available.
debian#debian:~$ python3
Python 3.9.6 (default, Jul 14 2021, 09:15:03)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socks
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'socks'
What is the matter with package----socks in my python?
pip might not be pointing to python3 ?
python3 -m pip list | grep ^s
selenium 3.141.0
setuptools 56.0.0
six 1.16.0
sniffio 1.2.0
socks 0
If you're unsure you have socks installed, use:
pip install socks
in the command prompt. That way it will either tell you that it's installed or install it for you

Numpy is installed but still get the error "No module named numpy"

I am trying to run a python script which needs numpy module ,when I try to install it,it shows it is already present, when I run import numpyit throws the error ImportError: No module named numpy,any guidance on what is wrong?
[username#machine build]$ pip install numpy
You are using pip version 7.1.0, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/lib64/python2.6/site-packages
Below command shows numpy is not installed
[username#machine build]$ python
Python 2.7.12 (default, Feb 22 2017, 20:16:44)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.version)
2.7.12 (default, Feb 22 2017, 20:16:44)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
If you're running Linux then use python2.7 -m pip install numpy
For python version 2.7 use python2.7 -m pip install numpy
Alternatively, on Windows under bash use py -2.7 -m pip install numpy

Install graph-tool for Anaconda Python3.6.3 on macOS X

How can I install graph-tool for Anaconda Python 3.6.3 on macOS High Sierra? (I've been able to install graph-tool for Python 2.7.10.) Thanks!
I followed the instructions and first tried
brew tap homebrew/science
but got "Error: homebrew/science was deprecated. This tap is now empty as all its formulae were migrated." Anyhow, I found a solution (forgot the exact brew command) and ran
brew install graph-tool
It now says "Warning: brewsci/science/graph-tool 2.26_1 is already installed". I can then import graph-tool from python 2.7,
$ /usr/bin/python2.7
>>> from graph_tool.all import *
but not from the anaconda distribution,
$ python
Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 6 2017, 12:04:38)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from graph_tool.all import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'graph_tool'

How do I get Python to see libtorrent-rasterbar in mac os?

I try to install libtorrent-rasterbar, but Python does not see the module. The El Captaine system. Tell me where to look?
andrew: ~ $ brew install python3
Warning: python3-3.6.0_1 already installed
andrew: ~ $ brew install libtorrent-rasterbar
Warning: libtorrent-rasterbar-1.1.1 already installed
andrew: ~ $ python
Python 3.6.0 (default, Mar 4 2017, 12:32:37)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import libtorrent
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'libtorrent'
>>>
For python2 it work: https://gist.github.com/jacobzelek/ecb6e98feb91d911e231
May be for python3 is similarly

Not able to import readline in django shell python

I am on Centos 6 Linux
When i try this
Python 2.7.3 (default, Nov 23 2012, 18:02:22)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import readline
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named readline
>>>
I try to install python readline with pip and i get this
virtualenv/bin/pip-2.7 install readline
Requirement already satisfied (use --upgrade to upgrade): readline in ./virtualenv/lib/python2.7/site-packages/readline-6.2.4.1-py2.7-linux-x86_64.egg
Cleaning up...
what should i do
EDIT:
I tried this as well
[myhost]$ virtualenv/bin/python2.7
Python 2.7.3 (default, Nov 23 2012, 18:02:22)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named readline
>>>
I tried all that
(virtualenv)[aaaaaa]$ source virtualenv/bin/activate
(virtualenv)[aaaaaa]$ virt
virtualenv/ virtualenv-clone virtualenvwrapper.sh
virtualenv-2.7 virtualenvwrapper_lazy.sh virt-what
(virtualenv)[aaaaaa]$ virtualenv/bin/pip
pip pip-2.7
(virtualenv)[aaaaa]$ virtualenv/bin/pip install readline
Requirement already satisfied (use --upgrade to upgrade): readline in ./virtualenv/lib/python2.7/site-packages/readline-6.2.4.1-py2.7-linux-x86_64.egg
Cleaning up...
(virtualenv)[aaaaa]$ python
Python 2.7.3 (default, Nov 23 2012, 18:02:22)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named readline
>>>
I tried all vitual env and activating as well. But again i get same error
You need to actually activate the environment you want to use, not just run the python binary from the enviroments bin folder:
$ source /path/to/envirn/bin/activate
$ pip install readline
$ python
> import readline
A workaround that worked for me is to re-install readline:
$ source /path/to/env/bin/activate
$ pip uninstall -y readline
Uninstalling readline-6.2.4.1:
Successfully uninstalled readline-6.2.4.1
$ pip install readline
Collecting readline
Installing collected packages: readline
Successfully installed readline-6.2.4.1

Categories

Resources