How to Install Python 2.7, IPython, Pyenv, Jupyter, and PyCharm on CentOS
This step‑by‑step guide shows how to compile and install Python 2.7 and IPython, manage multiple Python versions with pyenv, set up Jupyter Notebook, and configure PyCharm on Windows to remotely develop on a Linux server, covering all required packages and commands.
Compile and install Python 2.7 and IPython
1. Download required packages: ipython-1.2.1.tar.gz, Python-2.7.6.tar.xz from the official site.
ipython-1.2.1.tar.gz
Python-2.7.6.tar.xz
# Please download the specified packages from the official website.2. Install readline-devel via yum.
yum -y install readline-develIf this package is not installed, the Python interactive shell may not respond to the Backspace key.
3. Install gcc. yum -y install gcc 4. Extract and install Python 2.7.
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local/python27
make && make install5. Install IPython.
IPython enhances the Python command line with auto‑completion, auto‑indentation and many built‑in functions.
tar xf ipython-1.2.1.tar.gz
cd ipython-1.2.1
/usr/local/python27/bin/python2.7 setup.py build
/usr/local/python27/bin/python2.7 setup.py install6. Create symbolic links.
ln -sv /usr/local/python27/bin/python2.7 /usr/bin/python27
ln -sv /usr/local/python27/bin/ipython /usr/bin/Deploy Python with pyenv
What pyenv does
Installs Python interpreters
Manages multiple Python versions
Through plugins, manages virtual environments
Steps
1. Install git. yum -y install git 2. Define PYENV_ROOT. export PYENV_ROOT=/opt/pyenv 3. Install pyenv via the official installer.
# curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash4. Configure environment variables.
vim /etc/profile.d/pyenv.sh
export PATH="/opt/pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
sh /etc/profile.d/pyenv.sh5. Verify pyenv installation.
pyenv version
# Output "system" indicates pyenv works.Install Python 3.5.2 with pyenv
1. Install required build dependencies.
yum -y install gdbm-devel openssl-devel sqlite-devel readline-devel zlib-devel bzip2-devel patch2. Install Python 3.5.2.
pyenv install 3.5.2See pyenv help for detailed usage.
Additional notes
Cannot install the latest Python
Use pyenv install --list to view available versions and pyenv update to upgrade pyenv.
pyenv install --list
pyenv updateSlow installation
Cache the source tarball in ~/.pyenv/cache to speed up builds.
mv Python-3.5.2.tar.xz ~/.pyenv/cache/Python-3.5.2.tar.gzBasic pyenv usage
pyenv can manage multiple Python versions on a single server.
Common commands
pyenv install PYTHON_VERSION – install a specific version.
pyenv local PYENV_VERSION – set the version for the current directory.
pyenv versions – list installed versions.
pyenv version – show the version used in the current directory.
pyenv versions
pyenv versionSet a directory to use Python 2.7.6:
cd /root/python2
pyenv local 2.7.6
pyenv versionSet a directory to use Python 3.5.2:
cd /root/python3
pyenv local 3.5.2
pyenv versionNow different directories can use different Python versions.
Install Jupyter Notebook
Jupyter provides a web‑based interactive Python environment similar to IPython.
1. Configure pip to use a mirror.
vim ~/.pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com2. Install Jupyter via pip. pip install jupyter 3. Launch Jupyter. jupyter notebook --ip=0.0.0.0 --no-browser 4. Open a browser at http://<server_ip>:8888/tree to access the notebook.
Use PyCharm on Windows to connect to a Linux Python environment
Because Windows often has compatibility issues, it is recommended to develop on Linux and use PyCharm’s remote interpreter.
1. Download and install PyCharm Professional.
# Download from http://www.jetbrains.com/pycharm/download/#section=windows2. Add a remote interpreter via Settings → Project Interpreter → Add Remote → SSH.
3. Configure deployment (SFTP) to sync local project files to the Linux server.
4. Enable automatic upload (Tools → Deployment → Automatic Upload).
After saving a file, it is uploaded to the remote directory and can be executed directly.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
