Reputation: 1780
I'm trying to setup a server on Debian with Python 3.4.3 and pip.
I installed python 3.4.3 from source into the /opt directory (is that the right one to install to?). I exported the /bin to path with
export PATH="$PATH:/opt/python3.4.3/bin"
but when I close the ssh, it doesn't work when I log back in.
And there isn't a scripts folder... so where is pip?
Upvotes: 2
Views: 14150
Reputation: 1780
Update (7/22/15): Use pyenv - it's a python version and virtual environment manager. For Debian, apt-get will get an old version, so it's better to use pyenv which installs from the source. You have to download Python dependencies to accomplish this: https://github.com/yyuu/pyenv/wiki/Common-build-problems.
It appears pip
is packaged in the python source.
To install Python 3.4.3 from source on Debian:
$ apt-get update
$
$ cd /
$ sudo apt-get install libssl-dev openssl
$
$ cd opt
$ wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz
$ tar xzf Python-3.4.3.tgz
$
$ cd Python-3.4.3
$ ./configure
$ make
$ sudo make install
To use:
$ python3
$ pip3
Upvotes: 13
Reputation: 508
Add the line in which you export the PATH
variable to the .profile and it will work after logging back in.
You can do this by executing
echo 'export PATH="$PATH:/opt/python3.4.3/bin"' >> ~/.profile
Instead of changing the PATH
variable, you could simply install python into the system directories (where it is better placed), by going to the root of the source directory and running
./configure
make
sudo make install
If pip is distributed within the python source, then it will be installed, too. Check if pip has been installed by executing
pip --version
If it is not, you have to manually install pip, too.
https://pip.pypa.io/en/latest/installing.html explains how this is done.
Simply download the script get-pip.py
and run it like this
sudo python get-pip.py
Upvotes: 5
Reputation: 489
The thing is your export is only working for the session you are. When you logout and then login, a new session is created. Just put export PATH="$PATH:/opt/python3.4.3/bin"
in your ~/.bashrc
or ~/.profile
and this will be executed everytime you login to a server.
And you can add the repositories for Debian testing and install python3.4 from there. This is what I have done in a Debian 7 server.
And pip lives in the bin/ directory.
Upvotes: 0