I am trying to open a python script in cmd however, [Errno 2] is popping up! Can anyone help, i've tried everything.. even trying to add the path to the system variables.
Also, for some reason, whenever i enter a basic command like cd, 2 lines are skipped and nothing happens.
Try to open your command line and navigate into the directory where your Python file is located. You can do this by:
cd "<your-path-here>"
Now you can see, that it does not say C:/Nicole/... anymore, but this specified directory.
To ensure that your file is within this folder you can do
dir # suggestion from comment
this will list all files within this folder. If you now do
python snippet.py
it will execute the Python file.
Your problem it's still foggy. Anyway, you must install two python packages:
nltk (as the message 'module nltk not found' suggests)
numpy
To achieve this, use the 'pip' tool from the command prompt:
c:\Users\nicol> pip install nltk
c:\Users\nicol> pip install numpy
Depending on your Python flavour, the command may become
py -m pip install nltk
or a similar one (READ THE DOCS!) or it may use a different way to install packages.
Then, you must fix your snippet by adding these lines:
nltk.download('punkt')
nltk.download('averaged_perceptron_tagger')
nltk.download('universal_tagset')
nltk.download('maxent_ne_chunker')
nltk.download('words')
just after the 'import nltk' statement.
If you plan to have fun with Python, a powerful tool like 'PyCharm' it's a 'must have'. Download it from JetBrains site.
Go to the folder your script is saved and Shift+Right Click and select Open Powershell Here. And run the same command. Or if you really want cmd go to the address bar and type in cmd and run the command there.
Related
quick question.
I'm trying to instal bs4 but when i run:
"setup.py install" it opens the .py file in my Pycharm.
Im unable to change the type (it will eventually use another type of program to open it). and I tried to remove the file association from PyCharm but have no positive results.
How can I stop PyCharm from opening the script from cmd when I run it ?
ps.: OS windows 7
From what I understand from your question, you're just clicking on the setup.py file and trying to install it that way which won't work. What you'll need to do is this:
Go into the folder where Bs4 is extracted to.
Where it has the content for the installation i.e setup.py
shift + right click in the folder, and click on open command window here
Final step! type python setup.py install in the command window.
That will then install the library!
I'm trying to get new packages (request for example) and trying to do it through easy_install, but when I try to open it (both easy_install and easy_install-3.6) all I get is a blank terminal screen popping up for a second and than closing with nothing happening. What's wrong with it and how can I get new packages?
easy_install must be used as a command in the command prompt and it cannot be opened as an application. Go to the folder where easy_install is and open command-prompt in that folder. Now perform installation of any libraries using:
>easy_install pandas #example
Or you can set this path in your environment variables and use it instead of using this path to install everytime.
I'm pretty new to the community, and new to python. I know the basics. But now I'm trying to download third party modules via pip but everything I do regarding pip displays an error. I know that pip comes with python seeing as the pip file is there.
I am running python 3.6 and windows 10. I have downloaded pip off the internet also but when I try to run the program it says already downloaded. The first time I ran it it said that it was downloading and successfully downloaded so I'm kind of lost.
Thanks!
Sounds like it's already properly installed. pip is a program called from a system terminal, not from a Python prompt. Open up a command prompt and type pip -h see what happens. If this does not print out the help page on how to use pip, and instead you get an error to the effect of:
"pip" is not recognized as an internal or external command, operable program or batch file
You then need to point Windows where to find the program (pip.exe) by adding your Python scripts folder C:\...\Python36-32\Scripts\ to your environment PATH variable. To do this, open the Start menu and search for "environment variables". Open the dialogue and find one named PATH (case doesn't matter). If it doesn't exist, create it. Edit the value and add the file path to the scripts folder to the end using ; as a separator.
As per your comment, if you are getting an access denied windows error this answer from another question may help you.
You need need to be sure either your powershell is being run as administrator, or by creating a virtual environment.
The Installing Packages docs have a great overview, and instructions.
https://packaging.python.org/installing/#use-pip-for-installing
I'm trying to use clarifai with python, I've installed the package using pip, but then it says (here) to get started by configuration as follows.
Configuration
The client uses CLARIFAI_APP_ID and CLARIFAI_APP_SECRET for authentication and token generation. You can get those values from https://developer.clarifai.com and then run:
$ clarifai config
CLARIFAI_APP_ID: []: ************************************YQEd
CLARIFAI_APP_SECRET: []: ************************************gCqT
The config will be stored under ~/.clarifai/config for client's use
But I do not understand where I "run" this from and do i need the "$". I've tried running it from python command prompt and windows command terminal but it just gives errors.
I have a Python27/scripts folder, in this I have a file caled 'clarifai' but with unknow extension i.e. I dont know if its a .py file or .exe file, I have no idea. If I open that file in notepad it reads
""" the clarifai command line utility,
Basically it helps to setup the environmental variables for the
API Clients """
So this is exactly what I want to do set the 'environmental variables' CLARIFAI_APP_ID: and CLARIFAI_APP_SECRET: but i have no idea how to do this. I tried to run this in the windows command terminal and in the python terminal but get errors both times.
someone suggested below "You should probably run in the folder you installed it to". But I did not install this, pip installed this I I dont understand where it installed it to?
Where should do you think they are implying I run this from?
You do not need the $. You should probably run in the folder you installed it to, provided you didn't add to %PATH% yet. If you did, anywhere should be fine. Windows CMD or PowerShell is probably what they want.
Had a friend write some script for me. After about an hour, he declared himself one working on it and sent it to me to complete. So I downloaded Python27 and have been tying to get my head in the game.
My friend used some extra modules in his program and I need to get those up and running before I can see the code running.I've tried following several instructionals with no success.
So I was hoping for some help. My Python directory is where it should be in C:\Python27. I've been trying to use the Python )command line) in order to input the code as given and i keep getting back the same result.
"File " line 1
$pip install requests
SyntaxError: invalid syntax
I am completely lost and starting to get a headache. Please help!
'pip' is a command line program, not a python construct.
Try How do I install pip on Windows?
first to get the pip command on Windows.
You should not use python command line interpreter to install the package.
First, follow this question to install pip on Windows. Then you can directly put the pip install command in your cmd.exe and execute it.