Python 3.2.3, easy_install, Mac OS X

我们两清 提交于 2019-12-08 02:11:48

问题


I am a windows 7 user, so pardon me for my ignorance. I have been trying to help my friend get easy_install working on her Mac OS X laptop. We managed to get everything working for 2.7 with these commands in the terminal:

python distribute_setup.py (which installs "distribute")

easy_install

We tried the same thing for Python 3.2.3:

python3.2 distribute_setup.py

easy_install

But the package gets installed for python 2.7 instead of 3.2.3. From what I know, this is because easy_install only works with 2.7.

On my windows 7, I managed to do all these by going into the command prompt, python32 directory and doing:

python distribute_setup.py

Then going into the python32/script directory and running easy_install.exe directly:

easy_install

This installs the package to python 3.2.3 with no problems.

Question:

What should we be doing for Mac OS X? Is there a Mac equivalent of running "easy_install.exe"?


回答1:


You've done the right first step, python3.2 distribute_setup.py. That should have installed a version of easy_install for your python3.2. Now you need to actually use that easy_install command rather than the ones that come pre-installed with OS X for the system Pythons. If you still have the output from the above command or if you run the command again, near the end you should see two lines like this:

Installing easy_install script to /Library/Frameworks/Python.framework/Versions/3.2/bin
Installing easy_install-3.2 script to /Library/Frameworks/Python.framework/Versions/3.2/bin

Those locations are for the OS X Python3.2 downloaded from python.org, you might see something else for other versions. That shows the directory where the easy_install scripts were installed. You could use an absolute path to execute the script:

/Library/Frameworks/Python.framework/Versions/3.2/bin/easy_install ...

but that's rather inconvenient. If you are planning to use Python3.2 extensively, you can modify your shell search PATH to add this directory to it. For most shells on OS X:

export PATH=/Library/Frameworks/Python.framework/Versions/3.2/bin:$PATH

You can add that to a shell initialization file, like ~/.bash_profile. If you installed the python.org Python 3.2, you can just double-click /Applications/Python 3.2/Update Shell Profile.command to do that for you. You will need to open an new terminal window afterwards to see the change.




回答2:


For what its worth on my install of python3 (using homebrew), calling the correct binary was all that was required. easy_install3 was already on the system path, as was easy_install-3.3.



来源:https://stackoverflow.com/questions/12392699/python-3-2-3-easy-install-mac-os-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!