Pip: adding directory to PATH
First, you're running the program with python 2.7 not with python 3.x To run the python on python 3.x use
python3 program.py
Second, regarding the warning. It means the path of the pip is not added to the environment variable PATH. Means you can't call pip from any location, you need to go to its root path to call pip.
Run the below command to update the environment variable PATH to include the root path of pip.
export PATH=/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin:$PATH
This change is temporary. Depends on your OS, different process you need to follow to permanently update environment variable PATH
user1658080
Updated on June 13, 2022Comments
-
user1658080 almost 2 years
I am completely overwhelmed with installing Python3 and Pip. After running
brew install Python3
it seems like Python3 was successfully installed.Now I tried to run Scrapy again but this error occurs:
-bash: /usr/local/bin/scrapy: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory
I guess because the Python version changed? So I tried to uninstall Scrapy which needs pip.
Here comes the next issue - after installing pip like explained here (https://pip.pypa.io/en/stable/installing/#install-pip) I see this error:
Clms:~ userName$ python3 -m pip install -U --force-reinstall pip Collecting pip Using cached pip-20.0.2-py2.py3-none-any.whl (1.4 MB) Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 20.0.2 Uninstalling pip-20.0.2: Successfully uninstalled pip-20.0.2 WARNING: The scripts pip, pip3 and pip3.7 are installed in '/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed pip-20.0.2
I truly have no idea how to fix that mess. Googled for hours, tried a lot but could not figure out to resolve this situation. Most explanations I encounter require more knowledge about this topic and one leads to the other.
I would be highly grateful for a rescue!
Thanks!
-
jordanm about 4 yearsThe error you get means that the python2.7 that you have is the wrong architecture (eg 32bit on a OS that will only run 64bit).
-
AMC about 4 years_ am completely overwhelmed with installing Python3 and Pip._ I would recommend using virtual environments, you'll feel much safer, and it should simplify things.
-
user1658080 about 4 yearsScrapy used to run just fine. I needed to update and now the mess. As far as I know there is no Python 2.x left on my machine. Any idea what I should do to have Python 3.x + pip work fine on my Mac? Thanks!
-
AMC about 4 years@user1658080 Virtual environments ;p
-
-
user1658080 about 4 yearsThanks so much! Works now again. How can I make it permanent? :)
-
m0dknight about 4 yearsYou can check the below thread for Mac OS. For other OS, google it :P. [stackoverflow.com/questions/60204290/…