Multiple problems with pip3, python3 and pygame - macos

I'm trying to install pygame on my mac. I'm running OSX El Capitan 10.11.5. When i try installing pygame via pip3:
pip3 install pygame
It comes out with this error
-bash: /usr/local/bin/pip3: /usr/local/opt/python3/bin/python3.5: bad interpreter: No such file or directory
I have checked that pip3 is actually installed by typing
which pip3 -version
/usr/local/bin/pip3
I am at a total loss and it's confusing me quite a bit.. Am i doing it wrong?

Upgrade pip and try
pip install -U pip
After install a virtualenv
pip install --ignore-installed virtualenvwrapper
Edit .bash_profile, in terminal write
echo "source /usr/local/bin/virtualenvwrapper.sh" >> .bash_profile
Refresh bash_profile, in Terminal write source .bash_profile
Make a virtualenv and using python3
mkvirtualenv MyProject --python=python3
And go to your virtualenv
workon MyProject
Now install pygame from pip pip install pygame or pip3 install pygame

Related

Unable to create process using "c:\users\hp\anaconda3\python.exe"

C:\Users\HP\badminton_site\badminton>scrapy shell https://stackoverflow.com/questions/ask
Fatal error in launcher: Unable to create process using '"c:\users\hp\anaconda3\python.exe" "C:\Users\HP\Anaconda3\Scripts\scrapy.exe" shell https://stackoverflow.com/questions/ask: The system cannot find the file specified.
Why it is showing such error in anaconda prompt and command prompt?
Uninstall and reinstall the pip:
python -m pip uninstall pip
python -m pip install --upgrade pip
Update pip
python -m pip install -upgrade pip
i reinstalled the anaconda in another diretory and that worked for me

Cannot install jupyter notebook

In windows 7, I try to install jupyter notebook using:
pip3 install jupyter
But I get error:
Command "python setup.py egg_info" failed with error code 1 in C:\Users\AppData\Local\Temp\pip-build-5in28fbw\pywinpty\
Best thing to do is to install Anaconda here
It includes its own "conda" terminal window for "windows", which will make it a lot easier for you to invoke jupiter notebook from the conda terminal, regardless of which folder you are in
First update if using linux system:
sudo apt-get update
sudo apt-get upgrade
Restart the system and try below steps:
Installing Jupyter with pip
As an existing or experienced Python user, you may wish to install Jupyter using Python’s package manager, pip, instead of Anaconda.
If you have Python 3 installed (which is recommended):
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install jupyter
If you have Python 2 installed:
sudo python -m pip install --upgrade pip
sudo python -m pip install jupyter
Congratulations, you have installed Jupyter Notebook! To run the notebook, run the following command at the Terminal (Mac/Linux) or Command Prompt (Windows Run CMD in Admin):
jupyter notebook
Update your setuptools and pip first then retry:
pip install --upgrade setuptools pip

New to Homebrew, no pip install?

I just downloaded homebrew, and want to download ipython notebook.
pip install ipython
-bash: pip: command not found
Thanks.
I ended up doing a brew sudo install pip, and now I'll do sudo pip install for every package.

install virtualenv using pip or pip3?

I used brew to install both python2 and python3
brew install python
brew install python3
I noticed that there are pip and pip3 so which pip should I use to create virtualenv
pip install virtualenv or pip3 install virtualenv
Use pip install virtualenv to create a python env and pip3 install virtualenv to install a python3 env
The difference is required because if you use pip install virtualenv and need python3 packages, you will get all kinds of errors!
UPDATE (2020-03-12):
With python3 you can also use
python3 -m venv {directory}
where {directory} is the path of/to your virtualenv.
pip install virtualenv
This doesn't create any virtual environment. That installs virtualenv program, that is used in order to create virtual environments.
What is the default python version that your virtual environment will have is specified as an argument, when actually making the env, like:
virtualenv -p python3 my_venv
or
virtualenv -p python2 my_venv
regardless on how the virtualenv package was installed.
Furthermore checkout this
Your second question:"how can I know if that virtualenv is the one created by pip or pip3?"
-> You can activate the virtual environment with source bin/activate(first cd in the folder of the environment) When you are sure you are in the virtual environment, type "python --version". You can also check which python is active in the environment by typing "which python". Hope this helps.

I have installed virtualenv 1.9 which includes pip, but cannot install nltk

I have installed virtualenv 1.9 which includes pip, but cannot install nltk on my Mac. First it does not recognize pip as a command. Second how do I install nltk?
You should be able to run the following command to setup the virtual environment:
$ virtualenv venv
New python executable in venv/bin/python
Installing setuptools.............done.
Installing pip...............done.
Then activate the virtual environment using:
$ source venv/bin/activate
Then install nltk:
(venv)$ pip install nltk
When you are done with the virtual environment run:
$ deactivate
You may want to try installing Python using Homebrew rather than using the Python version included with the OS. With 'brew' you will not need to use virtualenv (unless you want to) because brew installs packages to /usr/local owned by you. So you can simply run 'pip install '.
Follow the installation instructions here for Homebrew. Then run:
$ brew install python
$ pip install nltk
You can install virtualenv as well if you want it.
$ pip install virtualenv

Resources