简体   繁体   中英

pip install mechanize works fine; why permission denied for pip2.7 install?

I'm on an AWS EC2 instance. Both Python 2.6 & Python 2.7 are installed.

My PYTHONPATH points to 2.7. I want to install the mechanize module.

sudo pip install mechanize

puts it in Python 2.6 :(

So I tried:

sudo pip2.7 install mechanize

sudo: pip2.7: command not found

How can I install mechanize?

I would setup a pyvenv installation of python.

This will give you full control over the python environment - plus if you ever mess it up - your default system version of python is not effected.

To do this

cd ~
pyvenv  py27
source py27/bin/activate
pip install --upgrade pip

And for mechanize

 pip install mechanize

尽管有些混乱,但是可以这样做:

sudo /usr/local/bin/pip2.7 install mechanize

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