Python Forum

Full Version: Instalation of library for Python 3 / 3.7
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I don't understand how to install a library available for all Python3 versions...

I installed "numpy" in this way:
Output:
sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
It's not working with Python 3.7.3 (Used by the default Python IDLE!!!):
Output:
yonnel@yonnel-Z97X-Gaming-7:~$ python3.7 Python 3.7.3 (default, Apr 3 2019, 19:16:38) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numpy Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'numpy' Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module> from apport.report import Report File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module> import apport.fileutils File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module> from apport.packaging_impl import impl as packaging File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module> import apt File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module> import apt_pkg ModuleNotFoundError: No module named 'apt_pkg' Original exception was: Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'numpy' >>> exit()
But it is working with Python 3.6.8:
Output:
yonnel@yonnel-Z97X-Gaming-7:~$ python3 Python 3.6.8 (default, Jan 14 2019, 11:02:34) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numpy >>> exit()
Python 3.7 is a Python3, isn't it?

Then I did:
Output:
python3 -m pip install --user numpy
And it's working now:
Output:
yonnel@yonnel-Z97X-Gaming-7:~$ python3.7 Python 3.7.3 (default, Apr 3 2019, 19:16:38) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numpy >>> exit() yonnel@yonnel-Z97X-Gaming-7:~$
It's not make sens for me...
-> Is that's meen that for Python 3.7.4 ot Python 3.8.x I will have to re-install all my libraries?
-> apt-get is not installing libraries for the default version of python IDLE?
-> Default version of Python in command line and in the oficial IDLE are not the same and it's cause problem...

What is the right libraries's management policy?

Thank you
pip is good if package from pypi,
otherwise you can use apt-get,
or if a wheel with pip as well