getting "SyntaxError" when installing twilio in the Windows command line interface - python-2.7

I'm new here and also a new Python learner. I was trying to install twilio package through the Windows command line interface, but I got a syntax error(please see below). I know there're related posts, however, I was still unable to make it work after trying those solutions. Perhaps I need to set the path in the command line, but I really have no idea how to do that...(I can see the easy_install and pip files in the Scripts folder under Python) Can anyone please help? Thanks in advance!
Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation.
All rights reserved.
C:\WINDOWS\system32>python Python 2.7.10 (default, May 23 2015,
09:44:00) [MSC v.1500 64 bit (AMD64)] on wi n32 Type "help",
"copyright", "credits" or "license" for more information.
easy_install twilio File "", line 1
easy_install twilio
^ SyntaxError: invalid syntax

You need to navigate to c:\python27\scripts and then run the command
easy_install twilio
this link helps too:
https://s3.amazonaws.com/udacity-hosted-downloads/ud036/How+to+install+Twilio+on+Windows.pdf

You should not type python first, then it becomes python command line.
Open a new command prompt and directly type:
easy_install twilio

go to the command prompt
it will say the account and all that jazz.
type cd ..
then hit enter
it will say C:\Users>
type cd .. again
then it will say C:>
type cd python27 (or the name of your python folder)
it will say C:\Python27>
type cd scripts
it will say C:\python27/scripts>
type easy_install twilio
then wait for it to run the procceses and then you will have twilio installed to python.

Related

Python 2.7.13 configured with `--enable-optimizations` puts many trash logs

when I open python console and close it by Ctrl + D,it comes with many logs.
why? how can I get rid of this.
$ /usr/local/bin/python
Python 2.7.13 (default, May 23 2017, 19:19:44)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> // close with Ctrl + D
profiling:/root/Python-2.7.13:Cannot create directory
profiling:/root/Python-2.7.13/Objects/bytes_methods.gcda:Skip
profiling:/root/Python-2.7.13:Cannot create directory
profiling:/root/Python-2.7.13/Python/structmember.gcda:Skip
profiling:/root/Python-2.7.13:Cannot create directory
profiling:/root/Python-2.7.13/Python/getcopyright.gcda:Skip
...
This happened to me using Debian Stretch whilst installing Python 3.6.1. I initially installed it with, "sudo make altinstall" which caused those errors. However, if you install it as root rather than using sudo, the errors go away.
I answered this question a bit late but I hope it helps someone.
This happened to me when I did ./configure --enable-optimizations. Removing the --enable-optimizations flag before compilation and installation makes these messages go away.

What's the best way to install two versions of python

I want a easy and clean installation, in case a need to uninstall in future.
I'm running Sierra on my mac, currently I have a Anaconda 2.4 (with python 2.7) and now I need to use python 3.5 too. I looked to quite a few answers and the process seemed a little tricky to un-do if necessary.
Please, if possible, post also the uninstall process. Thanks.
Don't let the long answer intimidate you, the process can be resumed to 6 lines (really), but I tried to write the answer that I was looking for.
The option that suit me the best is virtualenv.
Installation
The simplest way is using brew:
brew install pyenv pyenv-virtualenv pyenv-virtualenvwrapper
to check the list of python versions we can use the command:
pyenv install -l
since I am interested in 3.5.1, I can easily install with the same command
pyenv install 3.5.1
Setup
Once installed, we can check the result using
$ pyenv versions
* system
3.5.1 (set by /Users/macbookpro/.pyenv/version)
this command list all versions installed, and indicates that I'm currently using system's version.
Before we change to 3.5.1 version we need to add pyenv path to .bash_profile.
In the file .bash_profile :
add the following lines. Pay attention if the PATH variable is the same in your case.
#added for pyenv
export PATH="/Users/macbookpro/.pyenv:$PATH"
eval "$(pyenv init -)"
eval "(pyenv virtualenv-init -)"
So now we have everything setup, let's test it
First, we check which version is currently in use:
$ pyenv versions
* system
3.5.1 (set by /Users/macbookpro/.pyenv/version)
Ok, now we know we have to change to 3.5.1. We can do it using:
$ pyenv global 3.5.1
$ python
Python 3.5.1 (default, Oct 20 2016, 21:43:48)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
We also verified that this is actually working. We now test the system version too.
$ pyenv global system
$ pyenv versions
* system (set by /Users/macbookpro/.pyenv/version)
3.5.1
$ python
Python 2.7.12 (default, Sep 5 2016, 20:55:16)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
Everything is working fine.
Uninstall
Simply :
$ rm -fr ~/.pyenv
And remove all the .bash_profile stuff that we added in setup.
Extras
For the Anaconda folk.
In jupyter :
In [1]: import sys
sys.version
Out [1]: '2.7.12 |Anaconda 4.1.1 (x86_64)| (default, Jul 2 2016, 17:43:17) \n[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)]'
Nothing changed.
The best way is to use virtualenv. It allows you to keep different working versions of python on the same machine without interfering with each other.
EDIT:
These are the instructions on how to install virtualenv on Mac OS.
Install the latest python version on your system:
brew install python (or python3)
Then using pip:
pip install virtualenv
Then in your home directory edit the .bashrc file. Create it if it doesn't exist. Add this line to the .bashrc file:
export PIP_REQUIRE_VIRTUALENV=true
The line above will make pip run only in virtual environment.
Apply the changes:
. .bashrc (if you in your home directory, note the dot and space before .bashrc file).
Now you should be able to use virtualenv.
If you in your project folder:
virtualenv some_venv
Then activate it:
. ./some_venv/bin/activate (note the dot).
Then you can install everything you need using pip. All the packages will go to the some_venv directory.
You want to deactivate the virtualenv, then run deactivate.
If you want to delete all the installed packages when you were under virutalenv, then just delete some_venv. That's it.
Regarding the pyenv. Honestly I have never used it. But there is an easy to follow tutorial on the github page of the project.
Hope it helps.

Installing Pygame on 64-bit Windows 7 and 64-bit Python 2.7

The title says it all. I do see similar questions, someone suggested about http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame, but all the pygame downloadable files are in .whl format which I have no idea how to run on Windows 7. I tried "cd [directory] > pip install [filename]" without success.
This worked from me (Windows 7, python 2.7, 64 bit):
pip install C:/Users/ujjwal.karn/Downloads/pygame-1.9.2a0-cp27-none-win_amd64.whl
I downloaded the file pygame-1.9.2a0-cp27-none-win_amd64.whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame as well.
In general, whl files are installed with pip:
pip install whatever.whl
Open the .whl file through WinRar and just extract the contents(you will find 3 folders) into your Python folder.
For example : if you had installed python 2.7.3 in C:, then your directory to extract will be C:\Python27
You are doing right. Please just check python command it should display win64
C:>python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (In
tel)] on win64 Type "help", "copyright", "credits" or "license" for more information.
if output is win32 install pygame‑1.9.2a0‑cp34‑none‑win32.whl

Pygame works in IDLE, but not in CMD\PowerShell [2.7.3][Win7] [duplicate]

The title says it all. I do see similar questions, someone suggested about http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame, but all the pygame downloadable files are in .whl format which I have no idea how to run on Windows 7. I tried "cd [directory] > pip install [filename]" without success.
This worked from me (Windows 7, python 2.7, 64 bit):
pip install C:/Users/ujjwal.karn/Downloads/pygame-1.9.2a0-cp27-none-win_amd64.whl
I downloaded the file pygame-1.9.2a0-cp27-none-win_amd64.whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame as well.
In general, whl files are installed with pip:
pip install whatever.whl
Open the .whl file through WinRar and just extract the contents(you will find 3 folders) into your Python folder.
For example : if you had installed python 2.7.3 in C:, then your directory to extract will be C:\Python27
You are doing right. Please just check python command it should display win64
C:>python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (In
tel)] on win64 Type "help", "copyright", "credits" or "license" for more information.
if output is win32 install pygame‑1.9.2a0‑cp34‑none‑win32.whl

Can't find django-admin.py in Lubuntu 12.10

I just installed Lubuntu 12.10 on a new laptop, and I'm trying to get Django working. I installed it from Synaptic Package Manager, and when I try to make a sample project on the command line, this is what I get:
amanda#amanda-ThinkPad-E420:~$ django-admin.py startproject caltrain
django-admin.py: command not found
And I verified Django is installed correctly,
amanda#amanda-ThinkPad-E420:~$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())
1.4.1
>>>
Is this some sorta path issue or something? I don't remember having this issue on my Mac, but again I'm not very Unix savvy to begin with.
This information may be a bit stale, but I found this information that seems similar to your problem: http://ubuntuforums.org/showthread.php?t=1267372
With this solution:
Name of "django-admin.py" was changed to "django-admin" in /usr/bin directory in the python-django package.
To get around this I just created a symbolic link to django-admin named django-admin.py.
ln -s /usr/bin/django-admin /usr/bin/django-admin.py (as root)
Hope this helps, but again this was written in 2009.
You should see this. it contains details concerning problems with django-admin.py location
https://docs.djangoproject.com/en/1.6/faq/troubleshooting/#troubleshooting-django-admin-py