Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6674593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:45:50+00:00 2026-05-26T03:45:50+00:00

I followed this tutorial in order to install python2.7 on my CentOS 5.5: http://villaroad.com/2010/10/rolling-python-2-6-2-on-centos-5-3/

  • 0

I followed this tutorial in order to install python2.7 on my CentOS 5.5:
http://villaroad.com/2010/10/rolling-python-2-6-2-on-centos-5-3/

After installation of python 2.7 I’ve got:

/opt/python2.7$ ls -la
total 24
drwxr-xr-x 6 root root 4096 2011-10-01 22:32 .
drwxr-xr-x 4 root root 4096 2011-10-01 22:32 ..
drwxr-xr-x 2 root root 4096 2011-10-09 19:51 bin
drwxr-xr-x 3 root root 4096 2011-10-01 22:32 include
drwxr-xr-x 4 root root 4096 2011-10-01 23:34 lib
drwxr-xr-x 3 root root 4096 2011-10-01 22:32 share

/opt/python2.7$ ls -la bin
total 88
drwxr-xr-x 2 root root  4096 2011-10-09 19:51 .
drwxr-xr-x 6 root root  4096 2011-10-01 22:32 ..
-rwxr-xr-x 1 root root   105 2011-10-01 22:32 2to3
-rwxr-xr-x 1 root root   296 2011-10-09 19:49 easy_install
-rwxr-xr-x 1 root root   304 2011-10-09 19:49 easy_install-2.7
-rwxr-xr-x 1 root root   103 2011-10-01 22:32 idle
-rwxr-xr-x 1 root root   254 2011-10-03 01:37 pip
-rwxr-xr-x 1 root root   262 2011-10-03 01:37 pip-2.7
-rwxr-xr-x 1 root root    88 2011-10-01 22:32 pydoc
-rwxr-xr-x 2 root root 11783 2011-10-01 23:34 python
-rwxr-xr-x 2 root root 11783 2011-10-01 23:34 python2.7
-rwxr-xr-x 1 root root  1628 2011-10-01 23:34 python2.7-config
lrwxrwxrwx 1 root root    16 2011-10-01 23:34 python-config -> python2.7-config
-rwxr-xr-x 1 root root 18551 2011-10-01 22:32 smtpd.py
-rwxr-xr-x 1 root root   289 2011-10-09 19:51 virtualenv

I use /opt/python2.7/bin/virtualenv binary to create an environment in /var/www/myproj/env

cd /var/www/myproj 
virtualenv --no-site-packages -p /opt/python2.7/bin/python \ 
     --clear --prompt="(myproj.com) " env

Activate it, and do pip install flask. pip installes flask to env/lib/python2.7/site-packages and it’s not on sys.path

$ python
Python 2.7.2 (default, Oct  1 2011, 23:29:08)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import flask
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named flask
>>> import sys
>>> sys.path
['', '/opt/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', 
'/opt/python2.7/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg', 
'/opt/python2.7/lib/python27.zip', '/opt/python2.7/lib/python2.7', 
'/opt/python2.7/lib/python2.7/plat-linux2', '/opt/python2.7/lib/python2.7/lib-tk', 
'/opt/python2.7/lib/python2.7/lib-old', '/opt/python2.7/lib/python2.7/lib-dynload', 
'/opt/python2.7/lib/python2.7/site-packages']

I tried the same but using easy_install instead of pip – same result.

Flask is installed under env/lib/python2.7/site-packages, so the main question is: don’t virtualenv have to add env/lib/python2.7/site-packages to the python’s sys path? If not, what do I do better:

  • add an appropriate site-packages directory on python path at runtime (e.g. sys.path.insert(0, <path to site-packages>) in my flask application,
  • modify system’s PYTHONPATH or
  • trigger virtualenv’s after_install method to add <path to site-packages> to python’s path

?

some more info:
I’ve added to user’s and root’s ~/.bash_profile (~/.profile on Ubuntu)

alias python='/opt/python2.7/bin/python'
alias python2.7='/opt/python2.7/bin/python'
PATH=$PATH:/opt/python2.7/bin

did source ~/.profile
which python produces /usr/bin/python which is 2.6.4 (hmmmm…)

Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

Odd enough, but if I run python I’m getting the right version:

$ python
Python 2.7.2 (default, Oct  1 2011, 23:29:08)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.

What is even more odd is that after following to the python2.7 installation tutorial I was getting /opt/python2.7/bin/python on which python command. Anyway, the question is up there, any help is appreciated. Please, consider that I’m a python newbie, – probably it’s a silly question I’m asking here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:45:51+00:00Added an answer on May 26, 2026 at 3:45 am

    Whenever you run a a command with Bash, it caches the command’s location. That may be what you’re running into here. Use hash -r to clean the cache.

    Note that you have three pythons in your system now: the system’s 2.6 in /usr/bin, the 2.7 in /opt/python2.7/bin/, and the virtualenv’s 2.7 in env/bin. Only the last one has flask installed. Make extra sure you’re caling that one.

    Also, don’t mess with the .bash_profile. Especially root’s .bash_profile – you don’t need root privileges for flask, do you? Stick to a virtualenv, it’s much cleaner and there’s a much lower chance you’ll mess up your system.
    (That being said, $PATH is scanned for the first match, so instead of PATH=$PATH:/opt/python2.7/bin you’d want export PATH=/opt/python2.7/bin:$PATH. But that’s for the next time you need to change $PATH, not for now.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I followed this tutorial http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac to install Ruby on Rails on Mac OS X
I followed this tutorial and the source code : http://blog.objectgraph.com/index.php/2010/04/20/encrypting-decrypting-base64-encode-decode-in-iphone-objective-c/ And then, I downloaded
I'm using Ubuntu 10, python 2.6.5 I'm following this tutorial: http://www.djangobook.com/en/2.0/chapter02 I followed all
I've followed this tutorial: http://anandhansubbiah.com/blog/writing-your-first-android-application/ , but no matter what I do, and what
I followed this tutorial: http://codeigniter.com/wiki/Internationalization_and_the_Template_Parser_Class/ The controller that loads the language is this one:
I followed this tutorial to setup SVN on my Fedora box http://www.ashishkulkarni.com/installing-subversion-on-fedora-linux/ It worked.
I've followed this tutorial to try to add a template to Visual Studio: http://www.switchonthecode.com/tutorials/visual-studio-how-to-create-item-templates
I am a new facebook application deverloper. I followed this tutorial: http://www.adobe.com/devnet/facebook/articles/video_facebook_quick_start.html but I
I followed this tutorial : http://blog.mugunthkumar.com/coding/iphone-tutorial-how-to-send-in-app-sms/ and I got the alert 'Text messaging is
i followed this tutorial (http://github.com/tupps/OpenFlow) for creating cover-flow , but in open flow openflow

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.