So we currently use python 2.6 for production, and I just installed pip
but couldn't get any output from cmd on windows 10. Then I tried with python -m pip ...
then I got d:\Python26\python.exe: pip is a package and cannot be directly executed
, it's quite annoying so how do I fix this problem?
Asked
Active
Viewed 3,360 times
1

Shane
- 4,875
- 12
- 49
- 87
-
What is the output of `python -c "import pip; print pip.__file__"`? Maybe something from your working directory shadows installed package. – Łukasz Rogalski Mar 10 '17 at 06:31
-
looks like it's all right: `d:\Python26\lib\site-packages\pip\__init__.pyc` – Shane Mar 10 '17 at 06:33
-
And what is `python -c "import pip; print pip.__version__"`? – Łukasz Rogalski Mar 10 '17 at 06:37
-
it's `9.0.1`, maybe 9.0.1 doesn't support 2.6? – Shane Mar 10 '17 at 06:50
-
Possible duplicate of [Execute an installed Python package as a script?](http://stackoverflow.com/questions/4050120/execute-an-installed-python-package-as-a-script) – Łukasz Rogalski Mar 10 '17 at 06:51
-
It looks like it's forbidden in Python 2.6. Try: `python -m pip.__main__`. – Łukasz Rogalski Mar 10 '17 at 06:51
-
Now it's working! Thanks a lot!! Any idea why `pip` alone not working in command line? – Shane Mar 10 '17 at 06:54
-
Possible duplicate of [Python \`no module pip.\_\_main\_\_;\` error when trying to install a module](http://stackoverflow.com/questions/28664082/python-no-module-pip-main-error-when-trying-to-install-a-module) – Emin Mastizada Mar 10 '17 at 07:03
1 Answers
0
pip
is a standalone executable, not package. After using get-pip.py
for installing pip, you should have pip executable in d:\Python26\
. Go to that folder to check if pip is there:
cd d:\Python26\
pip freeze
Then you need to add pip to your PATH: https://superuser.com/a/949573

Emin Mastizada
- 1,375
- 2
- 15
- 30
-
There's no pip executable in `d:\Python26\`, it's in `d:\Python26\Scripts`. And yes I've already added that path into my PATH – Shane Mar 10 '17 at 07:06
-
In that case you should be able to use `pip freeze` anywhere in shell. Also restart computer to update PATH (you can also find a way to do without restart, but in case with windows restarting is always better :D) – Emin Mastizada Mar 10 '17 at 07:12