NumPy en Ubuntu: de cero a tus primeros arrays

Guía para configurar Python en Ubuntu, crear un entorno virtual e instalar NumPy y Jupyter, con ejercicios básicos de NumPy y ejemplos de soluciones de datos e IA de Q2BSTUDIO.

27 ago 2025 • 4 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

Por qué este artículo

Hoy configuré un entorno limpio de Python en Ubuntu e hice mis primeras pruebas con NumPy. Anoto cada paso para que puedas repetirlo en minutos y también para mostrar cómo Q2BSTUDIO puede ayudarte a integrar soluciones de datos y machine learning en proyectos reales.

Requisitos previos

Ubuntu compatible con 20.04 22.04 24.04 o superior Terminal y confort básico ejecutando comandos de shell

Instalar Python y pip

Ubuntu incluye Python 3 pero conviene asegurarse de tener las herramientas actualizadas. Ejecuta en la terminal los siguientes comandos tal como aparecen

$ sudo apt update && sudo apt install -y python3 python3-pip python3-venv

$ python3 --version

$ pip3 --version

Crear un entorno virtual

Crea una carpeta dedicada para aprender NumPy y evita que los paquetes contaminen el Python del sistema

$ mkdir -p ~/numpy-learning && cd ~/numpy-learning

$ python3 -m venv numpy-venv

$ source numpy-venv/bin/activate

El prefijo numpy-venv indica que el entorno está activo y which python debería apuntar a la ruta dentro de numpy-venv

Instalar NumPy y Jupyter

Actualiza pip e instala NumPy y Jupyter dentro del entorno virtual

(numpy-venv) $ python -m pip install --upgrade pip

(numpy-venv) $ pip install numpy jupyter

Opcionalmente instala herramientas útiles para análisis y visualización

(numpy-venv) $ pip install matplotlib pandas

Verifica las instalaciones

(numpy-venv) $ python -c import numpy as np; print(np.__version__)

(numpy-venv) $ jupyter --version

Lanzar Jupyter Notebook

Arranca el servidor de Jupyter y abre el navegador o copia la URL con token

(numpy-venv) $ jupyter notebook

En la interfaz de Jupyter crea un nuevo notebook Python 3 y nómbralo numpy_basics.ipynb

Tus primeras operaciones con NumPy

A continuación una guía rápida para ejecutar en celdas de Jupyter sin usar comillas en los comandos presentados aquí

Celda 1 import y versión

import numpy as np print NumPy version y la variable np.__version__ desde Jupyter

Celda 2 crear arrays

a = np.array([1,2,3,4,5])

b = np.array([[1,2,3],[4,5,6]])

Celda 3 propiedades

print a.shape a.dtype print b.shape b.ndim b.size

Celda 4 indexación y slicing

print a[0] print a[-2:] print b[:,1]

Celda 5 operaciones vectorizadas

print a * 2 print a + 10 print a ** 2

Celda 6 broadcasting

row = np.array([10,20,30]) print b + row

Celda 7 agregaciones

arr = np.array([10,20,30,40,50]) print np.sum(arr) print np.mean(arr) print np.std(arr) print np.min(arr) print np.max(arr)

Celda 8 reshape

reshaped = b.reshape(3,2) print reshaped

Cerrar y desactivar

Guarda en Jupyter File Save and Checkpoint luego en la terminal donde corre Jupyter presiona Ctrl C para detener el servidor y desactiva el entorno con

(numpy-venv) $ deactivate

La próxima vez navega a la carpeta activa y vuelve a activar

$ cd ~/numpy-learning $ source numpy-venv/bin/activate (numpy-venv) $ jupyter notebook

Errores comunes y soluciones

pip instala en el lugar equivocado siempre usa python -m pip dentro del venv para ser explícito

(numpy-venv) $ python -m pip install numpy jupyter

jupyter comando no encontrado asegúrate de que el venv esté activo y reinstala pip y jupyter

$ source numpy-venv/bin/activate (numpy-venv) $ python -m pip install --upgrade pip jupyter

comprueba which python para evitar mezclar Python del sistema y el del venv

(numpy-venv) $ which python

evita sudo pip usa venv o actualiza pip desde el entorno virtual

Qué sigue

Prueba JupyterLab para una interfaz más moderna

(numpy-venv) $ pip install jupyterlab (numpy-venv) $ jupyter lab

Explora np.arange np.linspace np.random.rand np.vstack np.hstack añade matplotlib para visualizar y prepara ejercicios sobre boolean masking fancy indexing broadcasting

Acerca de Q2BSTUDIO

Q2BSTUDIO es una empresa de desarrollo de software y aplicaciones a medida especializada en inteligencia artificial ciberseguridad y servicios cloud aws y azure. Ofrecemos software a medida para empresas que necesitan soluciones personalizadas desde aplicaciones web hasta sistemas de datos avanzados. Nuestra experiencia en servicios inteligencia de negocio power bi e ia para empresas permite transformar datos en decisiones accionables.

Servicios destacados de Q2BSTUDIO

Aplicaciones a medida y software a medida desarrollo full stack integración de APIs y microservicios consultoría en inteligencia artificial agentes IA para automatización y chatbots soluciones de ciberseguridad para proteger infraestructuras servicios cloud aws y azure migración y optimización de cargas y proyectos de servicios inteligencia de negocio con Power BI e integración de modelos de IA para empresas.

Por qué elegirnos

Combinamos experiencia en ingeniería de software con conocimiento profundo en inteligencia artificial y ciberseguridad para entregar soluciones seguras escalables y adaptadas a cada cliente. Si buscas aplicaciones a medida software a medida o implantar una estrategia de ia para empresas Q2BSTUDIO acompaña desde la idea hasta la puesta en producción.

Contacto y proyecto piloto

Si este tutorial te ayudó y quieres llevar tus proyectos de análisis y machine learning al siguiente nivel contacta a Q2BSTUDIO para una consultoría inicial y un proyecto piloto que integre NumPy con pipelines de datos visualizaciones Power BI y agentes IA en la nube con servicios cloud aws y azure.

Palabras clave

aplicaciones a medida software a medida inteligencia artificial ciberseguridad servicios cloud aws y azure servicios inteligencia de negocio ia para empresas agentes IA power bi

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.