Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
So I have Python on my new Macbook Air and now I'm trying to download Django and having no luck. I've tried "wget" and the link from the Django site, then I downloaded it and tried "python setup.py install". In both cases I get invalid syntax. I have Python 2.712. I'd really appreciate any help!!
Thanks, Tom
The easiest way to install django is probably to use pip. You should already have it installed since you're running a Python 2.7 version greater than 2.7.9.
The latest official docs read:
Installing an official release with pip
This is the recommended way to install Django.
Install pip. The easiest is to use the standalone pip installer. If your distribution already has pip installed, you might need to update it if it’s outdated. If it’s outdated, you’ll know because installation won’t work.
Take a look at virtualenv and virtualenvwrapper. These tools provide isolated Python environments, which are more practical than installing packages systemwide. They also allow installing packages without administrator privileges. The contributing tutorial walks through how to create a virtualenv on Python 3.
After you’ve created and activated a virtual environment, enter the command pip install Django at the shell prompt.
The main reason for install django is that the django version is not match your python. From the notice of the Django official website and your python version, i think FOR python 2.7 the best django version is 1.8.X.
Here is the download link:
https://www.djangoproject.com/download/1.8.17/tarball/
You can download this version, and try the installation again.
Please see the official docs as this link.
https://docs.djangoproject.com/en/1.8/topics/install/#installing-official-release
With MacOSX, you have to download pip installer, then you can download very easily Django from pip.
I put two possibilities, depending to Python2 or Python3 :
# if pip not installed
$ sudo easy_install pip
# show current pip version
$ pip --version
# upgrade pip
$ sudo pip install --upgrade pip
Then you have to download Django :
# Django version for Python2
$ pip install Django
or
# Django version for Python3
$ pip3 install Django
You can check the Django version :
python -m django --version
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 months ago.
Improve this question
I was wondering since there are so many optinos to install a python package which one is be best and most convenient. should I install packages with sudo and pip3 commands,
E.g
sudo pip3 install <package>
only using pip3
E.g
pip3 install <package>
or using apt
sudo apt install <python-package>
I was wondering which is the go-to and will be most convenient in the future. Mostly wondering what is the difference between Sudo pip3 and pip3 what difference does it make and which one I should use.
Don't use sudo with pip. There is a chance you'll overwrite system-installed packages, and mess up your OS.
sudo apt install <python-package> is pretty safe, but may result in outdated packages, and will definitely not include all packages you may want to install.
pip3 install <package> will install packages for just the current user (thus, not system-wide; if you're the only user, you're fine), and is what I would recommend.
Going further, virtual environment or use of Conda (an "extended" virtual environment manager) are potentially even safer, at the cost of a little more work to set up, and a bit more disk space (usually, the latter is insignificant).
You will have to read up on the use of virtual environment or Conda. That topic is too long for a standard answer here.
I would suggest as first step reading package documentation, as it often contains information regarding how to install it. Few examples regarding popular packages
click suggests pip install click
jinja2 suggests pip install Jinja2
requests suggests python -m pip install requests
Before that check to what version pertains python in your machine (by checking output of python --version), if it is Python 2 and you want to install packages to Python 3, then you need to use pip3 and python3 rather than pip and python, if it is Python 3 you might use command as they are.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I was following the tutorial on Ansible docs but was unable to finish it:
$ python -m pip install --user ansible
Returns an error:
/usr/bin/python: No module named pip
While another guide installed it by using python-pip3 and then after running pip3 install --user ansible it was ready to go.
It finishes installation successfully, yet ansible is still not available:
-bash: /usr/bin/ansible: No such file or directory
I have never worked with Python or PIP in the past and I don't understand what could go wrong in the process to start debugging.
You should check your python version in the terminal with
$ which python
command and then this returns a path that contains python(probably this will return a path because almost all of Linux distro contains python). After that result, you could type
$ curl https://bootstrap.pypa.io/get-pip.py
in the terminal, and then type
$ python get-pip.py
pip will be installed after these commands.
I have not found a solution to this but instead I went with the CentOS Epel repository also described in the Ansible docs and it works this way.
sudo yum install epel-release
sudo yum install ansible
Edit: Ok, so all I had to do is to add the following to .bashrc file.
export PATH="$HOME/.local/bin:$PATH"
Fixed.
I'm running macOS 11.2.2 Big Sur and I'm trying to get pip to work with the latest Python 3.9.4. This turned out to be ridiculously difficult even though I've read a number of articles on the subject. Possibly, it is the debris I accumulated in the system over the years which is causing me trouble. I need advice as to how to get things right again.
Checklist:
/usr/local/opt/python/bin/python3 --version is Python 3.9.4 installed from brew in the most usual way; it's a symlink to ../Frameworks/Python.framework/Versions/3.9/bin/python3, which is in Cellar.
Both python and python3 commands are aliased to /usr/local/opt/python/bin/python3, they give the correct version.
I used both get-pip.py and ensurepip, and both of them say everything is fine: "Successfully installed pip-21.1.1 setuptools-56.0.0"
The only thing in env that has anything to do with Python is this part of PATH: /usr/local/opt/python#3.9/Frameworks/Python.framework/Versions/3.9/bin. The lack of this one is reported as warning when you install pip.
Still, I get this:
python -m pip --version
/usr/local/opt/python#3.9/bin/python3.9: No module named pip
What am I missing? 🤯
I also found this article that instructs to use pyenv, but running it on the latest macOS is yet another problem: pyenv install 3.9.4 doesn't build for some reason.
Using pointers from #gold_cy in the comments I was able to resolve the problem by running get-pip.py with an additional parameter: --prefix=/usr/local/.
While the official pip installation guide does mention that there may be problems on the systems like macOS that manage their own Python install, it doesn't say directly what you can do about it. Which is a shame, because the phrasing in PyPA » Python Packaging User Guide » Tutorials » Installing Packages is exactly the same, only the last phrase is missing from pip's page:
Warning Be cautious if you’re using a Python install that’s managed by your
operating system or another package manager. get-pip.py does not coordinate
with those tools, and may leave your system in an inconsistent state. You can
use python get-pip.py --prefix=/usr/local/ to install in /usr/local which is
designed for locally-installed software.
I was trying to resolve the problem for python3 in MacOS. The accepted answer didn't help me.
What helped me is complete reinstall of the python3:
brew uninstall python3 # if python3 worked before
brew install python3
I'm doing a little project and I need to install a different version of python on a box on which I don't have superuser rights. Already tried installing python to a directory for which I do have permissions, but I would still need to build it using make, which the box doesn't have installed. Any ideas?
Sounds like you may want to use pyenv to install python
Since you can run pip, you can install a virtual environment to play in. For that, I recommend virtualenvwrapper which is installable via pip install virtualenvwrapper.
The docs on the linked site have more details on what you need to do to get it up and running.
This question already has answers here:
What is the most compatible way to install python modules on a Mac?
(13 answers)
Closed 8 years ago.
i'm learning python from on online book and have come to the stage where the author asks the reader to install pip, virtualenv, nose, and distribute. to make it fun, he asks the reader to figure out how :-)
well, i'm an utter novice and have spent the last week trying to figure that out
on the basis of recommendation i found, i've downloaded homebrew and tried to use pip (sudo easy_install). it runs ok and says something about finishing processing dependencies.
yet when i try nosetests, i get a 'command not found'.
Edit - Zmo, i tried what you suggested and this is the result. thanks for your help.
unknown-00-25-00-47-cc-3d:~ k$ sudo /usr/bin/easy_install pip
Password:
Searching for pip
Best match: pip 1.5.4
Processing pip-1.5.4-py2.7.egg
pip 1.5.4 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin
Using /Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
unknown-00-25-00-47-cc-3d:~ k$ sudo /usr/local/bin/pip install nosetests
Downloading/unpacking nosetests
Could not find any downloads that satisfy the requirement nosetests
Cleaning up...
No distributions at all found for nosetests
Storing debug log for failure in /Users/k/Library/Logs/pip.log
I have two requests for the community:
1) can someone help me solve this specific problem? (i use a 2009 mac with mavericks) and
2) can someone point me in the direction of some resources online where an utter novice like myself can learn about packages for python? (every resource i see assumes some level of knowledge, which i don't have).
thanks in advance,
K.
I recommend going through the tutorial and installing first "easy Install" http://pythonhosted.org/setuptools/easy_install.html and then install pip and the rest of the items with it.
Also you can follow the tutorial on (http://pip.readthedocs.org/en/latest/installing.html ) after that everything will be installed with pip itself.
PS: This question also can be useful (What is the most compatible way to install python modules on a Mac?)
anyway, as you're on OSX 10.9, run exactly what follows in the terminal:
sudo /usr/bin/easy_install pip
sudo /usr/local/bin/pip install nosetests
if you get errors here, please copy/paste them in your question as an edit
/usr/local/bin/nosetests
for the resources, please refer to leonardo's links, all I'd do is copy/paste them here (or do the same duckducking as he did).