Why am I getting an invalid syntax error?
I am following the tutorial to install Requests library, an HTTP library for Python. Query Installation Guide
The tutorial says to install the Requests library just run this command in my terminal
pip install requests
I didn't use this terminal to run this command, but first I tried Windows cmd after downloading pip, a package management system used to install and manage software packages written in Python (shown below)
Then I tried Python 3.4.2 terminal (shown below)
Does anyone know which terminal is running this command and what is my syntax error for that terminal (tried both)? This is strange to me because the Python terminal was able to recognize the pip but not install .....
source to share
You can also create a virtual environment for your project and install all the modules you want to use. It looks like you are using a windows machine. The commands will look like this
C:dirrectory_for_your_project>c:\Python34\python.exe c:\Python34\Tools\Scripts\pyvenv.py env #create your environment C:dirrectory_for_your_project>env\Scripts\activate.bat #activate your enviornment (env) C:dirrectory_for_your_project>pip install requests #pip modules you would like to include in your project (env) C:dirrectory_for_your_project>python script.py #run script
There is also a deactivate script if you want to exit the env. Make sure to activate env whenever you try to run your script from command line and you should be fine.
Note. It's just a different solution to your problem and based on personal preference. You should still add the required scripts to your path as it may come in handy in the future.
source to share