pip install -U PACKAGENAME --user
With --user they are installed in your $HOME directory in:
$HOME/.local/lib/python2.7/site-packages
Using sudo your package will be installed in:
/usr/local/lib/python2.7/dist-packages/
pip install -U PACKAGENAME --user
With --user they are installed in your $HOME directory in:
$HOME/.local/lib/python2.7/site-packages
Using sudo your package will be installed in:
/usr/local/lib/python2.7/dist-packages/
On Ubuntu, you can set proxy by using
export http_proxy=http://username:password@proxy:port
export https_proxy=http://username:password@proxy:port
or if you are having SOCKS error use
export all_proxy=http://username:password@proxy:port
Then run pip
sudo -E pip3 install {packageName}
The pip’s proxy parameter is, according to pip --help, in the form scheme://[user:passwd@]proxy.server:port
You should use the following:
pip install --proxy http://user:password@proxyserver:port TwitterApi
Also, the HTTP_PROXY env var should be respected.
To import a file from current directory use the following:
sys.path.append('<absolute path>')
import backend
I installed the newer version of python (3.2.3) than the one available in Fedora16 (python2.7)
And now yum stops working. It shows the following error.
[root@localhost yum-3.4.3]# yum
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^
Because yum dose not support Python3. You can run command vi /usr/bin/yum, change /usr/bin/python to /usr/bin/python2 in first line. Thus you can run the command yum by Python2 instead of Python3.
I got the same error. I did this and it worked!
sudo apt-get install --reinstall python2.7
This to reinstall python. Don’t ever try to uninstall python ,it will crash your OS as part of Ubuntu is dependent on python.Then,
sudo apt-get purge python-pip
This is to remove pip.
wget https://bootstrap.pypa.io/get-pip.py
Installs pip..`
sudo python get-pip.py
Then,you can install packages using pip like
sudo pip install package-name