LoginSignup
20
22

More than 5 years have passed since last update.

ubuntu 16.04でPython3.7を使う

Last updated at Posted at 2018-07-02

はじめに

Python 3.7がリリースされました。

ubuntu 18.04は、リポジトリに追加されたそうですが、ubuntu 16.04では追加されていません。
なので、ソースからインストールした手順をまとめておきます。

前提

今は無き純正cloud9上で作業をしています。
テンプレートはblankを選択しています。
OSはubuntu 16.04

元々pythonは以下がインストールされています。

コマンド バージョン
python2.7 2.7.6
python3 3.6.3
python3.4 3.4.3
python3.6 3.6.3

インストール

curl -O https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar xvfz Python-3.7.0.tgz
cd Python-3.7.0/
./configure --prefix=/usr/local/python370 --with-ensurepip
make
sudo make install

--prefix=はインストール先指定
--with-ensurepipはpipも一緒にインストールという意味です。

pipenvインストール

これは、どのバージョンでも構いません。
デフォルトでインストールしてあるpython3.6でインストールしています。

sudo pip3 install pipenv

pipenv環境設定

mkdir python37
cd python37
pipenv --python /usr/local/python370/bin/python3 install
pipenv shell
python --version

これで無事に環境作成ができました!!

※今回は、試しに使ってみるためにpython37というディレクトリを作成しましたが、本来はプロジェクトごとにちゃんとした名前のディレクトリを作成しましょう!

20
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
22