Python package installation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python package installation

After installing python package (numpy) using pip, I discovered that I could only use it for that particular project. How do I install the packages to make them available for all project

22nd Apr 2020, 8:04 AM
Kenechukwu Nzelu
Kenechukwu Nzelu - avatar
2 Answers
+ 3
You need to import numpy wherever you need it For example, your project has code1.py, code2.py, code3.py and code4.py Then you have to import numpy for each of them, unless you have import it in code1 and code2 imports code1, so that numpy is already imported, which you don't need to import again Or, you can write another code, imports.py for example, and import all what you need in that code, so that any other codes only need to import the imports.py and have all packages needed
22nd Apr 2020, 9:01 AM
Flandre Scarlet
Flandre Scarlet - avatar
0
Thanks a lot. That was helpful
22nd Apr 2020, 9:20 AM
Kenechukwu Nzelu
Kenechukwu Nzelu - avatar