Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'can't open file 'pip': [Errno 2] No such file or directory' when installing gekko

Tags:

python

gekko

I'm trying to install the gekko module in my python terminal using

python install -m pip gekko

but it is throwing an error not recognizing pip:

can't open file 'pip': [Errno 2] No such file or directory.

I'm using the terminal in Pycharm with Python 3.7

like image 244
J Edward Hammond Avatar asked Apr 05 '19 23:04

J Edward Hammond


3 Answers

You may have just switched the order:

python -m pip install gekko

Installing from the command line with pip is okay as well:

pip install gekko

If you have multiple versions of Python (such as 2.7 and 3+), sometimes you want to specify that it is for Python 3+:

pip3 install gekko

Another way to install Gekko in Python is to install from a Python script:

try:
    from pip import main as pipmain
except:
    from pip._internal import main as pipmain
pipmain(['install','gekko'])

although this isn't the preferred option. See Installing python module within code

like image 104
John Hedengren Avatar answered Oct 17 '22 03:10

John Hedengren


I figured out the problem: apparently in later versions of Python (I'm using 3.7) the string for the terminal doesn't need python. I also didnt need to use the -m do declare pip a module as it isn't a module.

The string that worked:

pip install gekko
like image 2
J Edward Hammond Avatar answered Oct 17 '22 04:10

J Edward Hammond


I was facing the same problem, but

$python -m pip install gekko

worked for me.

like image 2
Pratika Avatar answered Oct 17 '22 04:10

Pratika