I tried to install django after python installation (3.4.0 version), the problem began when i tried to run the simple command: "pip install django" via the cmd - it did nothing (descending line and writes nothing). I forced it to apply the installation using the command: "python -m pip install django". Although it was declared that the installation was successful, when I run, for example, the command: "django-admin --version" it did nothing as well, but when i run the command: "python -m django-admin --version", it says that: "python.exe: no module named django-admin".
In general, each command associated to pip or to django does not work, such as:
pip help, pip X ot django X
Ps. I added the paths in 'Path' of the User Varuables and System Variables:
C:\Python34; C:\Python34\Scripts
For you and possible future users asking similar question:
Only the pip command runs the 2.7 Python interpreter. You are using the 3.4 version, so instead of pip you have to use the pip3.4 command.
Why? Python 2.7 is not compatible with the 3.x and higher versions.
In your case Django is installed only for the 2.7 version and if you run the python3.4 command, Django is not installed ("no module named django").
Related
I am a newbie in Python and had a problem with installing Python packages on my windows computer.
I installed Python itself and then had to install the packages "Numpy" and "Matplotlib" as well. My teacher told us to do it with the commands:
python -m pip install --upgrade pip
pip install numpy
pip install matplotlib
I managed to install Python but when I run the first command to install pip I got the error message telling me that Python is not found. I found the command py -m pip --version here and it worked. After running it pip got installed and I got the message "pip 22.3 from C:\Users\Kaja\Programs\Python\Python310\lib\site-packages\pip (python 3.10)". I guessed this message means that its working.
I had a similar problem with the commands to install Numpy and Matplotlib. It only worked with this commands
py -m pip install numpy
py -m pip install matplotlib
I searched the internet and found this question telling me to run the command doskey py=python and it did not work. But when I swapped py and python so that the command was doskey python=py I eventually could run my teachers commands.
I checked the windows documentation and they are using the same commands as my teacher. I am very curious to know why I had this problem because on my fellow students computers it worked without the doskey command.
Edit:
Thank you very much #RustyPython.
I checked my environment variables and the path to the python.exe was already there.
Out of curiousity I deleted the python.exe from the path variable and although I did that the commands still worked! Another thing I tried was to remove the doskey macro like discribed in this article but still the commands still run without any errors.
I think its something else.
When you install python on windows it usually comes with the python launcher. This provides a way to easily access all the python versions installed on your computer.
The python launcher uses the py command which access the default python version.
py -0p will show you all the installed versions.
See https://www.infoworld.com/article/3617292/how-to-use-pythons-py-launcher-for-windows.html for more details.
For the python command to work then the relevant directory containing python.exe needs to be added to your user PATH variable.
As has been said looks the the python directory is not on your PATH, but the python launcher is and finds the installed python.exe.
If you want python to work on command line then you'll need to add it to your PATH variable. https://realpython.com/add-python-to-path/#how-to-add-python-to-path-on-windows
I just downloaded VSCode on my Mac as well as Python and pip. I downloaded the latest version of Python via VS Microsoft extensions and installed pip using Python -m ensurepip --upgrade. I have python 2.7.16 on my Mac as well, I believe from my OS (it's not something I downloaded). I am trying to use pip and Python in VSCode. I have my interpreter in my virtual environment set to Python 3.8.2, and I created the virtual environment using "python3 -m venv .venv". However, every time I check the python version (with Python --version) in the terminal, it returns Python 2.7.16. I check the pip version, and there is no command found. When I check the pip3 version, I get back the following warning:
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
You can invoke Python with '-m pip' instead of running pip directly to avoid this problem.
pip 21.3.1 from /Users/username/Library/Python/3.8/lib/python/site-packages/pip (python 3.8)
Whenever I run Python -m pip or Python -m pip3, it returns "no module named pip".
When installing Python, I got a warning that Python 3 was not on the PATH, but it did not fix the issue when I tried to add the path. Unfortunately, I don't have much experience adding a path so I may have done that incorrectly.
Finally, I installed streamlit via pip3. It resulted in the following message but seemed to install. However, it could not be resolved when I tried to import streamlit in my code.
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
You can invoke Python with '-m pip' instead of running pip directly to avoid this problem.
Defaulting to user installation because normal site packages is not writeable
How do I add Python 3 to my PATH and ensure that VSCode runs Python 3 instead of 2?
Simply always refer 'python3' rather than 'python'.
python3 --version
python3 -m pip install blahblahblah
I use Python 3.8.5 on Windows 10 but I still don't have pip attached with Python. I test with this
pip --version
I have followed the instruction in https://pip.pypa.io/en/stable/installing/ but my computer just do nothing after I type in
python get-pip.py
Nothing appears, no error, no instruction and now I just don't know what to do to install pip. I found nobody having the same this error.
Pip comes with Python 3.8, but is located in the Python38/Scripts directory which isn’t added to the PATH environment variable by default on Windows. What is installed in the PATH is the Python Launcher...a tool to manage multiple installations of Python.
Run py -0 to see installed Pythons, and py -m pip to run pip under the latest version of Python installed.
If you do have multiple Python versions installed, py -3.8 -m pip will run pip under that specific version of Python.
Note that if you watch the installer, you do have the option to add the Python installation directory to the path, but if you plan to ever have multiple versions of Python installed it isn’t recommended.
Download the get-pip file from this link. https://bootstrap.pypa.io/get-pip.py
Change the current path of the directory in the command line to the path of the directory where the above file exists.
Run the command :python get-pip.py
One can easily verify if the pip has been installed correctly by performing a version check on the same. Just go to the command line and execute pip -V
If still not working then edit the path variable in settings. ref link. 'pip' is not recognized as an internal or external command
I am trying to install Pip as described here
When I run py get-pip.py I get the following error:
ERROR: pipenv 2018.11.26 requires virtualenv, which is not installed.
And if then i try to run pip -v, it says command not found
I dont know what could be the problem here. I ran the command in command prompt.
Edit: I also tried running command prompt in administrator mode. I am using py synonim for Windows 10
The link you provided says to use python get-pip.py instead of py get-pip.py. Maybe you can try this out.
Try typing this if you have single python version installed installed:
sudo apt install python*-pip
Here * can be either omitted or replaced by python version. Or if you think that you have pip, but it doesn't appear try running it as your current python module:
python* -m pip
As well as above, the * can be either omitted or replaced by python version
did you check if python is in your PATH environment ?
Python 3.8 Installation
and Did you check if you run it in the powershell?
pip Install in Windows 10 with Powershell
check your installation, I made it with a virtual machine.
I am trying to install some python packages from the python shell but I get syntaxError. I am using python 3.4.3 which supposed to come with pip installed and I can see pip3 pip3.4, pip, easy_install, and easy_install-3.4 under scripts but whenever I run the command in the shell I get syntax error.
Am I not supposed to use the python shell for package installation? I am using windows 8.1 if that would explain something. I tried these commands:
pip install packageName --- got syntaxError with this message:File '' line 1, pip install(with a mark at last l in install). easy_install packageName generated the same error message but with the mark at the last letter in the packagename, i double checked all spellings but I can't seem to see what the problem is. How can I install packages?
Am I not supposed to use the python shell for package installation?
No. Commands like pip are to be run on the operating system command line (i.e., the "DOS prompt" on Windows).
No you are just to use the Windows terminal for pip package installations.
If that does not work, ensure that you have installed Python properly following this guide Here.
Click Windows(button)+R then type cmd. In there type pip -V, what version does it show?
If you get pip 6.1.1 from C:\Python32\lib\site-packages <python 3.4> (depending on your directory) then you're good, simply make your installations from there.