Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I started learning python on a PC, by installing Python 3, and so when I switched to mac I thought "Look at that, you can just type idle in the terminal and there's Python 2, let me just use that," not wanting to have to deal with two versions on the same machine. However, I read that it's recommended to install a newer version of Python and not to mess up with the built-in install.
Is it a bad practice to use the built-in version? For the matter, I'm not a heavy programmer, just like to play with Python every now and then. The only extra module I've installed was Pillow.
You can use the built-in Python, there's nothing "bad" about it. If someday you run into some limitation (unlikely), you can always switch then.
As for me it isn't so bad, but it's not handy when you make deal with more then one project.
How to figure it out?
First of all, install virtualenv. I'm also using virtualenvwrapper to work with virtualenvs more convinent way. The main idea of virtualenv is to make every project have its own interpeter with set of libs its only needed.
And if you want to have multiple versions of python install pyenv.
It may looks redundantly, but believe - it won't be a pain to start using it, but it will make your work more clear and handy.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
So today I spent hours trying to understand why the package I installed using pip install in terminal was giving me an "module not found" error. Which I know is a file path problem. After a lot of tinkering around I eventually pip installed the library on powershell. Like magic it works. To avoid these headaches in the future and to gain a deeper understanding of all things programming does anyone have a book or class they could recommend to understand the circus of ide's, text editors, file paths, kernals, interpreters, compilers etc. I have no idea where to begin and it's really hard trying to troubleshoot these issues when I've never been given any formal instruction on how all these things work together. Is this something learning a language like C would help me understand? FYI Or does this just take pain and years of experience to navigate. FYI I've only taken a few basic college level python courses.
No, this has little to do with the programming language. It’s about knowing your way around your operating system. As such it’s not a good SO question; perhaps you should try superuser or one of the OS-specific StackExchange sites.
But what helps is understanding the command line. When you run “pip”, you need to make sure that the program pip - which is just a Python script - is being run by the same Python interpreter that you’ll be using later when you try to import the module.
Basic advice: find all the “python” and “python3” executables on your system. Pick the one you want, or install a new one. Either way, make sure that the directory containing it comes before any of the others in your command search path, and both names (with and without the 3) are there and point to the same binary file. That way you always know what you’re getting when you run “python” at the shell prompt. Make sure you configure your IDE to use the same one, too. And instead of typing “pip”, type “python -mpip” so that you know it’s at least installing into the same environment you get when you type “python”.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am making a program that will call python. I would like to add python in my project so users don't have to download python in order to use it, also it will be better to use the python that my program has so users don't have to download any dependency.
My program it's going to be writing in C++ (but can be any language) and I guess I have to call the python that is in the same path of my project?
Let's say that the system where the user is running already has python and he/she calls 'pip' i want the program to call pip provided by the python give it by my program and install it in the program directory instead of the system's python?
It's that possible? If it is how can I do it?
Real examples:
There are programs that offer a terminal where you can execute python to do things in the program like:
Maya by Autodesk
Nuke by The foundry
Houdini by Side Effects
Note: It has to be Cross-platform solution
There are programs that "freeze" your python program including Python itself, for example Pyinstaller (http://www.pyinstaller.org/)
It won't help with the requirement in the third paragraph though, for that you'd have to include Python itself as part of the complete download, which seems unnecessary.
In order to run python code, the runtime is sufficient. Under Windows, you can use py2exe to pack your program code together with the python runtime and all recessary dependencies. But pip cannot be used and it makes no sense, as you don't want to develop, but only use the python part.
To distribute the complete python installation, like Panda3D does, you'll have to include it in the chosen installer software.
You can use py2exe to turn you python program into an executable. You do not need to keep python in the executable.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to understand the difference between distributing a python application. The application should be used on both Windows and Mac OS platforms. I see there are two ways of doing it.
Either create a executable using py2exe / py2app etc
Distribute the application using pip.
I would like to understand the use-cases for both the solutions.
A few things. As Sam Chats mentioned, one possible use case for creating the executable is if you don't want to share your source code, while if you distribute the application using pip, you will be able to. Additionally, if you distribute using pip vs. creating an application, more users may be able to easily access your application. As an example, check out this StackOverflow answer as a reason for using pip over Anaconda
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Although this could be downvoted as an opinion based issue, I suspect there is a concrete answer to this:
I want to create a future-proof django project.
I want to maintain the best coding standards
I do in fact require a diversity of other python modules for the apps I am creating
I am shooting for best performance
With that in mind, should I stick to python2.7 because of it's great support and use? Or would it be better to use python3 because it is the way of the future?
Django's official stance is, as long as your dependencies support Python 3, to use Python 3. Python 3 has and will continue to receive new features and improvements, including better performance.
Unless you need modules that would be hard to port to Python 3 (simple ones can often be fixed just by running the builtin 2to3 tool), there isn't any reason not to use Python 3.
If the Python modules required are available for Python 3.x, then I would go ahead with the latest stable release. If not, don't be afraid to use Python 2.7 since performance is great and many 3.x improvements have been backported.
However, take into account that sooner or later you'll have to migrate to Python 3.
I would stick to python 2.7. It is more commonly used, and has lots of support.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am deciding whether to install python 3.4 or 2.7 on my home server running Ubuntu Server 14.04.2. I want to ensure that it has support from all the most used python libraries (scipy, numpy, requests, etc) but I am not sure how many of these packages fully support 3.4.
Do all 2.7 packages work on 3.4? If no, what are the differences between the two that causes this errors?
No, only packages specifically written to support both Python 2 and 3 will run on either.
It is possible to write polyglot Python, but this requires effort from the library author. Code written for Python 2.7 will not automatically work on Python 3.
Minor versions of python are mostly backwards compatible, however major versions do not maintain backwards compatibility. There are many libraries that work with both, but the language itself does not make that guarantee.