简体   繁体   中英

Make pip install package for specific Python installation

I have two versions of Python 2.7.

Using pip-2.7 install bsddb3 seems to install bsddb3 for the native OS X version of Python.

How do I change it to the version of Python located at

/Library/Frameworks/Python.framework/Versions/7.3/Resources/Python.app/Contents/MacOS

(Found the path with >>> os.path.dirname(sys.executable) which might not be correct. *nix still confuses me.)

Note AFAICS this is not a duplicate. The other qs asks how to install for specific versions (eg 2.7 vs 2.6).

First, create a virtualenv pointing at the python you want, using something like virtualenv -p PYTHON_EXE VIRTUALENV_DIR . Then activate that virtualenv with source VIRTUALENV_DIR/bin/activate and then running pip will be isolated and use the python of that virtualenv.

If you don't use virtualenv, start :)

doesn't running pip with the python to which you want to install the package like this works?

path/to/python path/to/pip install package_name

btw, why not create new virtualenv and use pip from there?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM