On 09-03-2015 21:25, Oscar Benjamin wrote:
On 9 March 2015 at 18:09, Markos<mar...@c2o.pro.br>  wrote:
I installed numpy in Debian (6.0) with the command:
apt-get install python-numpy

I just find that this package is exclusively for python 2.5 and 2.6

The idle3 use Python 3.1.3.

How to install numpy for Python 3 in order to use it with the idle?

Is there any simple way?
Hi Markos,

I'm not sure about Squeeze but on this Ubuntu 14.04 system you can
install numpy for Python 3 by typing:

     $ sudo apt-get install python3-numpy

The Python 3 version of the package is a relatively new addition to
the repositories though so it may not be available in Squeeze.

If there is no package then you can build numpy yourself. It's not too
hard to do. First make sure that you have pip installed for python3.
You can check if it's installed by typing:

     $ python3 -m pip

If it says

     /usr/bin/python3: No module named pip

then you don't have pip. You may be able to install pip with

     $ sudo apt-get install python3-pip

If not then you can install it by downloading the get-pip.py script from here:

     https://pip.pypa.io/en/latest/installing.html

Once you have that you can run it as

     $ sudo python3 get-pip.py

Once pip is installed you can use it to install lots of things
including numpy. For numpy in particular though you'll need to first
install the compilers and Python 3 header files:

     $ sudo apt-get install build-essential python3-dev

Now you can use pip to install numpy for python3:

     $ sudo python3 -m pip install numpy

This will download numpy from PyPI and then try to compile and install
it. Compiling numpy takes a while and you will see a lot of strange
compiler messages. If it fails then just post the very last part of
the output here. It will probably mean that you need to install more
compilers or something.

If it succeeds then you should be able to import numpy e.g.:

     $ python3
     Python 3.4.0 (default, Apr 11 2014, 13:05:11)
     [GCC 4.8.2] on linux
     Type "help", "copyright", "credits" or "license" for more information.
     >>>  import numpy
     >>>  numpy.cos(1)
     0.54030230586813977


Oscar
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Hi.

I don't have the python3-pip in the repository, then I downloaded the get-pip.py from:

https://bootstrap.pypa.io/get-pip.py

But when running the command "python3 get-pip.py" appears the error message (end of message).

I found a message about a bug with pip at https://github.com/pypa/pip/issues/1093

Is it the same kind of error?

Any tip?

And another doubt.

Is there any risk of numpy module to be used by python3 to conflict with the numpy module that is already installed for python2.5 and python2.6?

I still don't know the structure of Python packages.

Thank you very much for your detailed explanation.

Markos


# python3 get-pip.py
Collecting pip
  Exception:
  Traceback (most recent call last):
    File "/tmp/tmpn0At3p/pip.zip/pip/basecommand.py", line 232, in main
      status = self.run(options, args)
    File "/tmp/tmpn0At3p/pip.zip/pip/commands/install.py", line 339, in run
      requirement_set.prepare_files(finder)
File "/tmp/tmpn0At3p/pip.zip/pip/req/req_set.py", line 333, in prepare_files
      upgrade=self.upgrade,
File "/tmp/tmpn0At3p/pip.zip/pip/index.py", line 305, in find_requirement
      page = self._get_page(main_index_url, req)
    File "/tmp/tmpn0At3p/pip.zip/pip/index.py", line 783, in _get_page
      return HTMLPage.get_page(link, req, session=self.session)
    File "/tmp/tmpn0At3p/pip.zip/pip/index.py", line 872, in get_page
      "Cache-Control": "max-age=600",
File "/tmp/tmpn0At3p/pip.zip/pip/_vendor/requests/sessions.py", line 473, in get
      return self.request('GET', url, **kwargs)
    File "/tmp/tmpn0At3p/pip.zip/pip/download.py", line 365, in request
      return super(PipSession, self).request(method, url, *args, **kwargs)
File "/tmp/tmpn0At3p/pip.zip/pip/_vendor/requests/sessions.py", line 461, in request
      resp = self.send(prep, **send_kwargs)
File "/tmp/tmpn0At3p/pip.zip/pip/_vendor/requests/sessions.py", line 573, in send
      r = adapter.send(request, **kwargs)
File "/tmp/tmpn0At3p/pip.zip/pip/_vendor/cachecontrol/adapter.py", line 43, in send
      resp = super(CacheControlAdapter, self).send(request, **kw)
File "/tmp/tmpn0At3p/pip.zip/pip/_vendor/requests/adapters.py", line 370, in send
      timeout=timeout
File "/tmp/tmpn0At3p/pip.zip/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 518, in urlopen
      body=body, headers=headers)
File "/tmp/tmpn0At3p/pip.zip/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 322, in _make_request
      self._validate_conn(conn)
File "/tmp/tmpn0At3p/pip.zip/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 727, in _validate_conn
      conn.connect()
File "/tmp/tmpn0At3p/pip.zip/pip/_vendor/requests/packages/urllib3/connection.py", line 238, in connect
      ssl_version=resolved_ssl_version)
File "/tmp/tmpn0At3p/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py", line 254, in ssl_wrap_socket
      return context.wrap_socket(sock)
File "/tmp/tmpn0At3p/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py", line 80, in wrap_socket
      return wrap_socket(socket, ciphers=self.ciphers, **kwargs)
  TypeError: wrap_socket() got an unexpected keyword argument 'ciphers'

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to