I have installed django on my computer but when i try to run any django-admin command on my terminal i get this error:
django-admin : The term 'django-admin' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ django-admin startproject app
+ CategoryInfo : ObjectNotFound: (django-admin:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I am using powershell and visual studio code
Is there any way i can fix this?
Django is a widely used framework, and it can be installed on multiple architectures and operating systems, now, understanding this premise, imagine that you are in front of the computer trying to answer the question you are asking.
For some collaborators it is really difficult or impossible to try to reproduce the error that is being presented to you without more details, my advice is to reformulate the question, for example:
I have an old computer running windows 10.
I installed the binary version for windows of python 3.7.
I installed pip, poetry, pipenv, and virtualenv to make a virtual environment.
I created the virtual environment with the following instruction .....
I installed django with the following statement ....
I am trying to create my project with this instruction ....
I get the following error message.
BTW, all the instructions I am executing from my PyCharm IDE .....
I recommend you read the following manual http://www.catb.org/~esr/faqs/smart-questions.html
I hope this can be of help to you so that you can provide more information and in this way receive a correct answer.
Related
I just start the course "Building Neo4j Applications with Python" in Neo4j Graph Academy. In the course I created a virtual environment named sandbox with python -m venv sandbox but when I want to activate with the code indicated in the course: source sandbox/bin/activate the powershell console shows this error:
source : The term 'source' is not recognized as the name of a cmdlet, function, script file.
script or executable program. Check if you spelled the name correctly, or if you included a
path, check that the path is correct and try again.
On line: 1 Character: 1
+ source sandbox/bin/activate
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (source:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
This looks like you are on Windows, using PowerShell, and trying to activate the virtual environment with the bash/zsh script meant for Unix systems.
Instead, try running
sandbox\Scripts\Activate.ps1
You can find the full documentation with more details and things to consider here: https://docs.python.org/3/library/venv.html
Make sure to give it a good read.
I am trying to run a simple command in a .py file on Visual Studio Code, namely:
import os
I get the following return in the terminal:
& : The term 'C:/Users/Tim-S/anaconda3/envs/plotlyenv/python.exe' is not recognized as
the name of a cmdlet, function, script file, or operable program. Check the spelling of
the name
, or if a path was included, verify that the path is correct and try again.
At line:1 char:3
+ & C:/Users/Tim-S/anaconda3/envs/plotlyenv/python.exe "c:/Users/Tim-S/ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:/Users/Tim-S/...yenv/python.exe:String)
[], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Can anyone explain me how I can solve this?
Start by installing Python from python.org or choco. Then, in your terminal (cmd, powershell, windows terminal, etc.), run python. Only then, should you attempt to run anything in VS Code.
You may already be having success up to that point, but it isn't clear from your question. I can see you have some environment (anaconda) installed. There are several VS Code plugins for Python. This answer may help you further with that part.
Here is the Windows port of pyenv, which is an excellent version management tool, which may also be of use.
Are you trying to create a virtual environment: by the looks of the path in the error - 'C:/Users/Tim-S/anaconda3/envs/plotlyenv/python.exe'
seems like you are trying to do so. IF that's the case:
Possible it did not get installed properly and hence cannot find the python file
you have to reinstall it and activate the environment
But that will solve the problem partially
After activating virtual environment, you have to install the library
that you are going to use
What I can see from your problem statement and file path you will need to install os and plotly
pip install os
pip install plotly - if required
I am facing an issue with the Windows 10 Powershell. Whenever I open it I get an error:
& : The term 'C:\Users\hp\anaconda3\Scripts\conda.exe' is not recognized as the name of a cmdlet,
function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At C:\Users\hp\Documents\WindowsPowerShell\profile.ps1:4 char:4
+ (& "C:\Users\hp\anaconda3\Scripts\conda.exe" "shell.powershell" "hook ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\hp\anaconda3\Scripts\conda.exe:String) [], CommandNotFoundExce
ption
+ FullyQualifiedErrorId : CommandNotFoundException
Previously I had installed anaconda and vs code to work in python but later I uninstalled anaconda and downloaded python3 from https://www.python.org/downloads/.
I have added the environment variables for Python in Path but still I get this error in the Powershell.
How to fix this?
Uninstall any other python interpreter installation and restart to refresh env variables
Download Anaconda Installer from here
You should add it to PATH if you want to use it outside of Anaconda Navigator and I recommend you install it systemwide with admin privilege
This should add conda executable to PATH allowing it to be called systemwide
I know this has been asked before and I reviewed the previous posts, but none of those solved my issue.
I'm new to programming so I may get the terminology mixed up but I will try to explain in as much detail as I can.
I am running Python 3.8 on Visual Studio Code. I installed pipenv successfully:
python -m pip install pipenv
Then I try to actually use it and get this error:
pipenv shell --python 3.8
pipenv : The term 'pipenv' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ pipenv shell --python 3.8
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (pipenv:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
During installation I got this warning:
WARNING: The script f2py.exe is installed in 'C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
However, I don't actually know how to do this or even if I should, because I get this warning with every package I install but it works fine anyway.
I am following this tutorial:
Video Tutorial
and the guy specifically says to run the pipenv commands in the directory where our project is, which I am doing and I get this error. Nevertheless I tried to cd to the directory where the pipenv installed and same error.
I am on Win 10 btw. What am I doing wrong?
You may need to add pipenv to you path variable. Check out the note section in the docs. It actually describes how to get the right location to add on Windows:
On Windows you can find the user base binary directory by running
python -m site --user-site and replacing site-packages with Scripts.
For example, this could return
C:\Users\Username\AppData\Roaming\Python36\site-packages so you would
need to set your PATH to include
C:\Users\Username\AppData\Roaming\Python36\Scripts. You can set your
user PATH permanently in the Control Panel. You may need to log out
for the PATH changes to take effect.
That should get it recognized by your terminal.
The last sentence of that reminds me (it's been a while since I used Windows) -- have you tried to restart or logout? I'm not sure if that's necessary to be honest but I know sometimes it is.
Long story short (and only since you mentioned that you are new to programming) -- the "path" lists all of the locations that are accessible to execute from. You can add to it if you want to be able to execute new programs, like pipenv.
This is what solved the issue for me (Windows 10):
I added the correct Scripts folder of the Python version I am actually running. In my case this was C:\python\Scripts. I added that in Control Panel - search "environment" - Edit environment variables (both for my account and system-wide - did it on both places just to be sure, maybe redundant) - Path - Edit - added the path and now the issue is solved. Thank you!!! –
I recently installed MS Visual Studio Code for the first time (we'll be using it on an upcoming project). I wrote a simple Hello, World program in python and clicked Debug > Start Without Debugging. MSVSC runs the program just fine, but after that it runs a couple more commands, one of which generates an error (see below). These commands are unnecessary and the error is ugly and distracting.
Where is the script that MSVSC is running? I want to remove those two useless lines.
PS C:\Users\me> cd 'c:\Users\me\Documents\my-project'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'C:\Users\me\Anaconda3\python.exe' 'c:\Users\me\.vscode\extensions\ms-python.python-2019.4.12954\pythonFiles\ptvsd_launcher.py' '--default' '--nodebug' '--client' '--host' 'localhost' '--port' '51699' 'c:\Users\me\Documents\my-project\hello.py'
hello, world
distance 5.0
PS C:\Users\me\Documents\my-project> C:/Users/me/Anaconda3/Scripts/activate
PS C:\Users\me\Documents\my-project> conda activate base
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1
+ conda activate base
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\me\Documents\my-project>
They are not useless, you just happened to be running a file that happens to not need a specific conda environment activated. It's a general problem with conda that we're trying to solve. The smoothest experience would be to use virtual environments if that will work for you.