简体   繁体   中英

How to install numpy to Python 3.5?

I'm attempting to install numpy on python3.5 via :

python3.5 -m pip install numpy

but receive error :

/usr/local/bin/python3.5: No module named pip

Same error for pip3 :

python3.5 -m pip3 install numpy
/usr/local/bin/python3.5: No module named pip3

Reason I'm attempting to install numpy this way is pip3 is pointing to a 3.4 dist-packages dir :

pip3 install numpy
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/local/lib/python3.4/dist-packages
Cleaning up..

How to install numpy to Python 3.5 ?

Update:

I decided to use docker in order to install on a clean ubuntu14.04 environment and it worked out of box.

Although using virtual environment is advisable in many use-cases, it is not strictly required. You can have a system python3.5 and a pip installation associated with it.

Note that Python 3.5 is now end-of-life and pip has now dropped support . The final version of pip supporting Python 3.5 was 20.3.4 (Jan 2021).

  1. Download this file: pip-20.3.4-py2.py3-none-any.whl
  2. Bootstrap a pip installation using the wheel file: sudo python3.5 pip-20.3.4-py2.py3-none-any.whl/pip install pip-20.3.4-py2.py3-none-any.whl
  3. Install numpy with python3.5 -m pip install --user numpy

I strongly recommend using a virtual environment and in the case of the scientific Python stack, I further recommend using anaconda . It will save you loads of headaches in the future.

  1. Download anaconda for Python3.5.
  2. Create an environment.
  3. Activate it.
  4. conda install numpy .

Step 2 looks like this:

conda create --name env_name numpy

Step 3 looks like this:

source activate env_name

Step 4 looks like this:

conda install numpy

Now, anytime you want to use numpy or any other dependency in your environment, you just do source activate env_name .

To deactivate, do:

source deactivate

I'm attempting to install numpy on python3.5 via :

python3.5 -m pip install numpy

but receive error :

/usr/local/bin/python3.5: No module named pip

Same error for pip3 :

python3.5 -m pip3 install numpy
/usr/local/bin/python3.5: No module named pip3

Reason I'm attempting to install numpy this way is pip3 is pointing to a 3.4 dist-packages dir :

pip3 install numpy
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/local/lib/python3.4/dist-packages
Cleaning up..

How to install numpy to Python 3.5 ?

Update:

I decided to use docker in order to install on a clean ubuntu14.04 environment and it worked out of box.

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